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

Vlad Dumitrescu vladdu55@REDACTED
Thu Oct 20 14:38:24 CEST 2011


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



More information about the erlang-patches mailing list