RFR (s) 8158906: JShell: crashes with extremely long result value

ShinyaYoshida bitterfoxc at gmail.com
Fri Aug 19 14:22:24 UTC 2016


Hi Robert,
I think there is still the problem for Japanese(or Chinese?).

Could you try this test case?
    public void testLongRemoteJapaneseStrings() { //8158906
        assertEval("import java.util.stream.*;");
        assertEval("String m(int x) { return Stream.generate(() ->
\"\u3042\").limit(x).collect(Collectors.joining()); }");
        boolean[] shut = new boolean[1];
        getState().onShutdown(j -> {shut[0] = true;} );
        List<SnippetEvent> el = assertEval("m(65600);");
        assertTrue(shut[0] == false, "JShell died with long value");
        assertEquals(el.size(), 1, "Excepted one event");
        assertTrue(el.get(0).value().length() > 30000,
                "Expected truncated but long String, got: " +
el.get(0).value());
    }

"\u3042" is the first japanese character, あ(a) and it could be 3 bytes in
utf-8.
(
https://docs.oracle.com/javase/8/docs/api/java/io/DataOutput.html#writeUTF-java.lang.String-
)
I think it isn't yet resolved due to your code limit String to about 30000
characters.
i.e. the byte on the stream is still over about 60000.

If the test case pass, LGTM!

Regards,
shinyafox(Shinya Yoshida)


2016-08-19 10:15 GMT+09:00 Robert Field <robert.field at oracle.com>:

> Please review...
>
> Bug:
>     https://bugs.openjdk.java.net/browse/JDK-8158906
>
> Webrev:
>     http://cr.openjdk.java.net/~rfield/8158906v0.webrev/
>
> Thanks,
> Robert
>
>


More information about the kulla-dev mailing list