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

Vlad Dumitrescu <>
Wed Nov 23 20:34:10 CET 2011


Hi,

Ok, please refetch. I have rebased the branch on master, I hope it's
ok as R15A is out. The test is in a separate commit, so that you can
run it with the original jinterface if you want (to check that the bug
is there).

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

regards,
Vlad

On Wed, Nov 23, 2011 at 11:05, Henrik Nord <> wrote:
> On 11/23/2011 08:57 AM, Vlad Dumitrescu wrote:
>>
>> Hi!
>>
>> I have a test for this, but I couldn't test it with Java 1.5, as it's
>> a hell to try to install it in a newer Ubuntu. Please let me know if
>> you want to include it anyway or if Java 5 is to be considered
>> deprecated (it already passed its end-of-life and premier commercial
>> support is also not available anymore).
>>
>> best regards,
>> Vlad
>
> We would like it.
> Thank you
>>
>> On Wed, Nov 2, 2011 at 11:04, Henrik Nord<>  wrote:
>>>
>>> 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
>>>> 
>>>> 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
>>>
>>>
>
>
> --
> /Henrik Nord Erlang/OTP
>
>


More information about the erlang-patches mailing list