harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r500969 - in /harmony/enhanced/classlib/trunk/modules/swing/src: main/java/common/javax/swing/ main/java/common/org/apache/harmony/x/swing/internal/nls/ test/api/java/common/javax/swing/
Date Mon, 29 Jan 2007 08:41:12 GMT
Author: apetrenko
Date: Mon Jan 29 00:41:11 2007
New Revision: 500969

URL: http://svn.apache.org/viewvc?view=rev&rev=500969
Log:
Patch for HARMONY-2280 "[classlib][swing] DefaultListModel method removeRange(int fromIndex,
int toIndex) doesn't throw IAE for invalid parameters, when toIndex < fromIndex"

Modified:
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultListModel.java
    harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
    harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultListModelTest.java

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultListModel.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultListModel.java?view=diff&rev=500969&r1=500968&r2=500969
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultListModel.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/javax/swing/DefaultListModel.java
Mon Jan 29 00:41:11 2007
@@ -20,6 +20,8 @@
 import java.util.Enumeration;
 import java.util.Vector;
 
+import org.apache.harmony.x.swing.internal.nls.Messages;
+
 /**
  * <p>
  * <i>DefaultListModel</i>
@@ -146,6 +148,9 @@
     }
 
     public void removeRange(int fromIndex, int toIndex) {
+        if (fromIndex > toIndex) {
+            throw new IllegalArgumentException(Messages.getString("swing.01")); //$NON-NLS-1$
+        }
         for (int i = 0; i < toIndex - fromIndex + 1; i++) {
             internalStorage.remove(fromIndex);
         }

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties?view=diff&rev=500969&r1=500968&r2=500969
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/main/java/common/org/apache/harmony/x/swing/internal/nls/messages.properties
Mon Jan 29 00:41:11 2007
@@ -16,3 +16,4 @@
 
 # messages for EN locale
 swing.00=Invalid axis: {0}
+swing.01=fromIndex must be <= toIndex

Modified: harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultListModelTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultListModelTest.java?view=diff&rev=500969&r1=500968&r2=500969
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultListModelTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/swing/src/test/api/java/common/javax/swing/DefaultListModelTest.java
Mon Jan 29 00:41:11 2007
@@ -430,6 +430,14 @@
         });
     }
 
+    public void testRemoveRange_1(){
+        try {
+            model.removeRange(0, -1);
+            fail("IllegalArgumentException have to throw");
+        } catch (IllegalArgumentException iae) {
+        }
+    }
+    
     public void testSet() throws Exception {
         model.addElement("1");
         model.addElement("2");



Mime
View raw message