You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by sm...@apache.org on 2012/04/11 12:36:26 UTC

svn commit: r1324689 - /pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Author: smartini
Date: Wed Apr 11 10:36:26 2012
New Revision: 1324689

URL: http://svn.apache.org/viewvc?rev=1324689&view=rev
Log:
additional checks (and improved exception messages) in indexBoundsCheck

Modified:
    pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java

Modified: pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java
URL: http://svn.apache.org/viewvc/pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java?rev=1324689&r1=1324688&r2=1324689&view=diff
==============================================================================
--- pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java (original)
+++ pivot/trunk/wtk/src/org/apache/pivot/wtk/Component.java Wed Apr 11 10:36:26 2012
@@ -2927,11 +2927,17 @@ public abstract class Component implemen
      * @throws IndexOutOfBoundsException if index is out of range.
      */
     protected static final void indexBoundsCheck(String indexName, int index, int min, int max) throws IndexOutOfBoundsException {
+        if (max < min) {
+            throw new IllegalArgumentException("max (" + max + ") < " + "min (" + min + ")");
+        }
+        if (min < 0) {
+            throw new IllegalArgumentException("min (" + min + ") < 0");
+        }
         if (index < min) {
-            throw new IndexOutOfBoundsException(indexName + index + " < " + min);
+            throw new IndexOutOfBoundsException(indexName + ": index (" + index + ") < min (" + min + ")");
         }
         if (index > max) {
-            throw new IndexOutOfBoundsException(indexName + index + " > " + max);
+            throw new IndexOutOfBoundsException(indexName + ": index (" + index + ") > max (" + max + ")");
         }
     }
 }