From 334d63651255887a05c0dacebc370ed4b960dc89 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Fri, 11 Nov 2011 15:24:44 +0100 Subject: Improve error message when creating a too long OtpErlangAtom Also print the value that we tried to use for the atom. This helps a lot when debugging and doesn't affect anything when the length is normal. --- lib/jinterface/java_src/com/ericsson/otp/erlang/OtpErlangAtom.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang') 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; } -- cgit v1.2.3 From a30445c2a40ebc0e449c7b7605fdc202c48e00d8 Mon Sep 17 00:00:00 2001 From: Vlad Dumitrescu Date: Thu, 20 Oct 2011 14:29:59 +0200 Subject: workaround for 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); --- .../com/ericsson/otp/erlang/OtpErlangString.java | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang') 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 23734bf83b..2d3a5a5d1c 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; } /** -- cgit v1.2.3 From bc330f609b6ff751eefff4113d54f856832c3f30 Mon Sep 17 00:00:00 2001 From: Richard Carlsson Date: Mon, 31 Oct 2011 13:43:16 +0100 Subject: Correct spelling of "registered" in various places in the source code --- lib/jinterface/java_src/com/ericsson/otp/erlang/OtpMbox.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/jinterface/java_src/com/ericsson/otp/erlang') 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 71a419497a..de5e5ee65c 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; -- cgit v1.2.3