You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pivot.apache.org by rw...@apache.org on 2017/10/23 18:15:25 UTC

svn commit: r1813052 - in /pivot/trunk/core/src/org/apache/pivot/collections: ArrayList.java LinkedList.java adapter/ListAdapter.java

Author: rwhitcomb
Date: Mon Oct 23 18:15:24 2017
New Revision: 1813052

URL: http://svn.apache.org/viewvc?rev=1813052&view=rev
Log:
Update some exception messages to be clearer as to what the problem is.

Modified:
    pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
    pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
    pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java

Modified: pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java?rev=1813052&r1=1813051&r2=1813052&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/ArrayList.java Mon Oct 23 18:15:24 2017
@@ -239,7 +239,8 @@ public class ArrayList<T> implements Lis
             }
 
             if (index != i) {
-                throw new IllegalArgumentException("Illegal insertion point.");
+                throw new IllegalArgumentException(
+                    "Given insertion point " + index + " does not match the sorted insertion location " + i + ".");
             }
         }
 
@@ -272,7 +273,7 @@ public class ArrayList<T> implements Lis
 
                 if ((predecessorItem != null && comparator.compare(item, predecessorItem) < 0)
                     || (successorItem != null && comparator.compare(item, successorItem) > 0)) {
-                    throw new IllegalArgumentException("Illegal item modification.");
+                    throw new IllegalArgumentException("Updated item at index " + index + " is not in correct sorted order.");
                 }
             }
 

Modified: pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java?rev=1813052&r1=1813051&r2=1813052&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/LinkedList.java Mon Oct 23 18:15:24 2017
@@ -369,7 +369,7 @@ public class LinkedList<T> implements Li
             // predecessor and less than or equal to its successor
             if ((previous != null && comparator.compare(item, previous.item) < 0)
                 || (next != null && comparator.compare(item, next.item) > 0)) {
-                throw new IllegalArgumentException("Illegal item modification.");
+                throw new IllegalArgumentException("Updated or inserted item is not in correct sorted order.");
             }
         }
     }

Modified: pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java
URL: http://svn.apache.org/viewvc/pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java?rev=1813052&r1=1813051&r2=1813052&view=diff
==============================================================================
--- pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java (original)
+++ pivot/trunk/core/src/org/apache/pivot/collections/adapter/ListAdapter.java Mon Oct 23 18:15:24 2017
@@ -81,7 +81,8 @@ public class ListAdapter<T> implements L
     @Override
     public void insert(T item, int index) {
         if (comparator != null && Collections.binarySearch(list, item, comparator) != -(index + 1)) {
-            throw new IllegalArgumentException("Illegal insertion point.");
+            throw new IllegalArgumentException(
+                "Given insertion point " + index + " does not match the sorted insertion location.");
         }
 
         list.add(index, item);
@@ -126,7 +127,7 @@ public class ListAdapter<T> implements L
 
             if ((predecessor != null && comparator.compare(item, predecessor) < 0)
                 || (successor != null && comparator.compare(item, successor) > 0)) {
-                throw new IllegalArgumentException("Illegal item modification.");
+                throw new IllegalArgumentException("Updated item at index " + index + " is not in correct sorted order.");
             }
         }