Hey guys,

Based on Harmony's ListTest, a list should have at least 4 visible rows,
it should throw an ArrayIndexOutOfBoundsException (not an
IllegalArgumentExecption) in the replaceItem method and it should not
throw an IllegalArgumentException if the specified index is out of range
in the makeVisible method. 

Cheers,
Tania


2006-06-26  Tania Bento  <[EMAIL PROTECTED]>

        * java/awt/List.java
        (List): A list should have at least 4 visible rows.
        (replaceItem): Should throw an ArrayIndexOutOfBoundsException,
        not an IllegalArgumentException.
        (makeVisible): Should not throw an IllegalArgumentException if
        the specified index is out of range.

Index: java/awt/List.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/awt/List.java,v
retrieving revision 1.26
diff -u -r1.26 List.java
--- java/awt/List.java	6 Mar 2006 19:52:36 -0000	1.26
+++ java/awt/List.java	26 Jun 2006 18:08:28 -0000
@@ -161,7 +161,11 @@
 public 
 List(int rows, boolean multipleMode)
 {
-  this.rows = rows;
+  if (rows == 0)
+    this.rows = 4;
+  else
+    this.rows = rows;
+  
   this.multipleMode = multipleMode;
   selected = new int[0];
 
@@ -645,13 +649,13 @@
   * @param item The new item value.
   * @param index The index of the item to replace.
   *
-  * @exception IllegalArgumentException If the index is not valid.
+  * @exception ArrayIndexOutOfBoundsException If the index is not valid.
   */
 public synchronized void
-replaceItem(String item, int index) throws IllegalArgumentException
+replaceItem(String item, int index) throws ArrayIndexOutOfBoundsException
 {
   if ((index < 0) || (index >= items.size()))
-    throw new IllegalArgumentException("Bad list index: " + index);
+    throw new ArrayIndexOutOfBoundsException("Bad list index: " + index);
 
   items.insertElementAt(item, index + 1);
   items.removeElementAt (index);
@@ -818,15 +822,11 @@
 /**
   * This method ensures that the item at the specified index is visible.
   *
-  * @exception IllegalArgumentException If the specified index is out of
-  * range.
+  * @param index The index of the item to be made visible.
   */
 public synchronized void
-makeVisible(int index) throws IllegalArgumentException
+makeVisible(int index) 
 {
-  if ((index < 0) || (index >= items.size()))
-    throw new IllegalArgumentException("Bad list index: " + index);
-
   visibleIndex = index;
   if (peer != null)
     {

Reply via email to