You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by no...@apache.org on 2011/12/21 09:46:33 UTC

svn commit: r1221646 - /pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java

Author: noelgrandin
Date: Wed Dec 21 08:46:32 2011
New Revision: 1221646

URL: http://svn.apache.org/viewvc?rev=1221646&view=rev
Log:
improve exception message text to be more informative

Modified:
    pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java

Modified: pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java?rev=1221646&r1=1221645&r2=1221646&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/text/CharSequenceCharacterIterator.java Wed Dec 21 08:46:32 2011
@@ -42,7 +42,7 @@ public final class CharSequenceCharacter
 
     public CharSequenceCharacterIterator(CharSequence charSequence, int beginIndex, int endIndex, int index) {
         if (charSequence == null) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("charSequence may not be null");
         }
 
         if (endIndex == -1) {
@@ -50,17 +50,23 @@ public final class CharSequenceCharacter
         }
 
         if (beginIndex > endIndex) {
-            throw new IllegalArgumentException();
+            throw new IllegalArgumentException("beginIndex > endIndex, " + beginIndex + ">" + endIndex);
         }
 
-        if (beginIndex < 0
-            || endIndex > charSequence.length()) {
-            throw new IndexOutOfBoundsException();
+        if (beginIndex < 0) {
+            throw new IndexOutOfBoundsException("beginIndex < 0, " + beginIndex);
         }
 
-        if (index < beginIndex
-            || index > endIndex) {
-            throw new IndexOutOfBoundsException();
+        if (endIndex > charSequence.length()) {
+            throw new IndexOutOfBoundsException("endIndex > char sequence length, " + endIndex + ">" + charSequence.length());
+        }
+
+        if (index < beginIndex) {
+            throw new IndexOutOfBoundsException("(index < beginIndex, " + index + "<" + beginIndex);
+        }
+
+        if (index > endIndex) {
+            throw new IndexOutOfBoundsException("(index > endIndex, " + index + ">" + endIndex);
         }
 
         this.charSequence = charSequence;