[erlang-patches] jinterface: workaround for a Java bug

Henrik Nord henrik@REDACTED
Wed Nov 2 11:04:14 CET 2011


On 10/20/2011 02:38 PM, Vlad Dumitrescu wrote:
> git fetch git://github.com/vladdu/opt.git java_string_bug
>
> https://github.com/vladdu/otp/compare/java_string_bug
> https://github.com/vladdu/otp/compare/java_string_bug.patch
>
> OtpErlangString is affected by Java bug
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6242664
>
> Java 1.5 has a bug where detecting codepoint offsets in strings that are
> created by String.substring() gives wrong results. The new implementation
> uses a different method, avoinding the issue.
>
> The following code will crash without the fix:
>          final String s = "abcdefg";
>          final String ss = s.substring(3, 6);
>          final int[] cps = OtpErlangString.stringToCodePoints(ss);
>
> regards,
> Vlad
> _______________________________________________
> erlang-patches mailing list
> erlang-patches@REDACTED
> http://erlang.org/mailman/listinfo/erlang-patches
Hi

We would like a test for this.
The suggestion is to extend the lists_roundtrip_2 test in nc_SUIT.erl by 
adding a new tag for the codepoint operation, and consequently adding 
the same to echo_server.java similar to how "sub3atom" is done.

Thank you for the contribution!

-- 
/Henrik Nord Erlang/OTP




More information about the erlang-patches mailing list