diff options
author | Henrik Nord <[email protected]> | 2012-02-16 12:20:44 +0100 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2012-02-16 12:20:49 +0100 |
commit | 377672dbef977595bdfa8182f1eacac043753e74 (patch) | |
tree | e89690222b6bc2e8cf16687ce0f12b5ace9be2d0 /lib/jinterface/java_src | |
parent | 86ceb50d68ab3225b1152358f14125f01d705694 (diff) | |
parent | e01d6f39b940d917ae445d8428b154de87888000 (diff) | |
download | otp-377672dbef977595bdfa8182f1eacac043753e74.tar.gz otp-377672dbef977595bdfa8182f1eacac043753e74.tar.bz2 otp-377672dbef977595bdfa8182f1eacac043753e74.zip |
Merge branch 'vd/java-string-bug' into maint
* vd/java-string-bug:
add test for Java string bug
workaround for Java bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6242664
OTP-9927
Diffstat (limited to 'lib/jinterface/java_src')
-rw-r--r-- | lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java index 8cd900aada..be8b7c5c12 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangString.java @@ -154,13 +154,16 @@ public class OtpErlangString extends OtpErlangObject implements Serializable, * Unicode code points */ - public static int[] stringToCodePoints(final String s) { - final int m = s.codePointCount(0, s.length()); - final int [] codePoints = new int[m]; - for (int i = 0, j = 0; j < m; i = s.offsetByCodePoints(i, 1), j++) { - codePoints[j] = s.codePointAt(i); - } - return codePoints; + public static int[] stringToCodePoints(final String s) { + final int m = s.codePointCount(0, s.length()); + final int[] codePoints = new int[m]; + int j = 0; + for (int offset = 0; offset < s.length();) { + final int codepoint = s.codePointAt(offset); + codePoints[j++] = codepoint; + offset += Character.charCount(codepoint); + } + return codePoints; } /** |