diff options
Diffstat (limited to 'lib/jinterface')
5 files changed, 23 insertions, 11 deletions
diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java index 4d53447164..60eef7a126 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java @@ -53,7 +53,7 @@ public class OtpErlangAtom extends OtpErlangObject implements Serializable, if (atom.length() > maxAtomLength) { throw new java.lang.IllegalArgumentException("Atom may not exceed " - + maxAtomLength + " characters"); + + maxAtomLength + " characters: " + atom); } this.atom = atom; } 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; } /** diff --git a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java index d6f319d378..b0b64e6953 100644 --- a/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java +++ b/lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java @@ -141,7 +141,7 @@ public class OtpMbox { * Get the registered name of this mailbox. * * @return the registered name of this mailbox, or null if the mailbox had - * no registerd name. + * no registered name. */ public String getName() { return name; diff --git a/lib/jinterface/test/nc_SUITE.erl b/lib/jinterface/test/nc_SUITE.erl index da54f5bf51..9c88400c2a 100644 --- a/lib/jinterface/test/nc_SUITE.erl +++ b/lib/jinterface/test/nc_SUITE.erl @@ -296,7 +296,8 @@ lists_roundtrip_2(Config) when is_list(Config) -> {[z,23|24],tail3}, {[z|25],tail3}, {"abc123",sub3atom}, - {"abc",sub3atom} + {"abc",sub3atom}, + {"abcdefg",codepointBug} ], Trans = fun ([_|T], tail) -> @@ -308,7 +309,9 @@ lists_roundtrip_2(Config) when is_list(Config) -> (L, tail3) when is_list(L) -> null; ([_,_,_|L], sub3atom) -> - list_to_atom(L) + list_to_atom(L); + (L, codepointBug) -> + L end, OutTrans = fun ({L,Twist}) -> diff --git a/lib/jinterface/test/nc_SUITE_data/echo_server.java b/lib/jinterface/test/nc_SUITE_data/echo_server.java index 0550e4beb1..5ecb5b72a7 100644 --- a/lib/jinterface/test/nc_SUITE_data/echo_server.java +++ b/lib/jinterface/test/nc_SUITE_data/echo_server.java @@ -202,6 +202,12 @@ public class echo_server { final OtpErlangAtom o = new OtpErlangAtom(s.stringValue() .substring(3)); return o; + } else if (atomValue.equals("codepointBug") + && i instanceof OtpErlangString) { + final OtpErlangString s = (OtpErlangString) i; + final String ss = s.stringValue().substring(3, 6); + final int[] cps = OtpErlangString.stringToCodePoints(ss); + return s; } else if (atomValue.equals("utf8")) { if (i instanceof OtpErlangString) { final OtpErlangString s = (OtpErlangString) i; |