[cp-patches] FYI: JList.setLayoutOrientation() fixlet

David Gilbert david.gilbert at object-refinery.com
Mon Jun 26 13:25:13 UTC 2006


This patch (committed) adds an argument check to the setLayoutOrientation() method:

2006-06-26  David Gilbert  <david.gilbert at object-refinery.com>

	* javax/swing/JList.java
	(setLayoutOrientation): Check for valid argument.

Regards,

Dave
-------------- next part --------------
Index: javax/swing/JList.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/JList.java,v
retrieving revision 1.55
diff -u -r1.55 JList.java
--- javax/swing/JList.java	16 May 2006 14:17:30 -0000	1.55
+++ javax/swing/JList.java	26 Jun 2006 13:18:57 -0000
@@ -2228,11 +2228,13 @@
   }
 
   /**
-   * Returns the layout orientation.
+   * Returns the layout orientation, which will be one of {@link #VERTICAL}, 
+   * {@link #VERTICAL_WRAP} and {@link #HORIZONTAL_WRAP}.  The default value
+   * is {@link #VERTICAL}.
    *
-   * @return the orientation, one of <code>JList.VERTICAL</code>,
-   * <code>JList.VERTICAL_WRAP</code> and <code>JList.HORIZONTAL_WRAP</code>
+   * @return the orientation.
    *
+   * @see #setLayoutOrientation(int)
    * @since 1.4
    */
   public int getLayoutOrientation()
@@ -2241,15 +2243,21 @@
   }
 
   /**
-   * Sets the layout orientation.
+   * Sets the layout orientation (this is a bound property with the name
+   * 'layoutOrientation').  Valid orientations are {@link #VERTICAL}, 
+   * {@link #VERTICAL_WRAP} and {@link #HORIZONTAL_WRAP}.
    *
-   * @param orientation the orientation to set, one of <code>JList.VERTICAL</code>,
-   * <code>JList.VERTICAL_WRAP</code> and <code>JList.HORIZONTAL_WRAP</code>
+   * @param orientation the orientation.
    *
+   * @throws IllegalArgumentException if <code>orientation</code> is not one
+   *     of the specified values.
    * @since 1.4
+   * @see #getLayoutOrientation()
    */
   public void setLayoutOrientation(int orientation)
   {
+    if (orientation < JList.VERTICAL || orientation > JList.HORIZONTAL_WRAP)
+      throw new IllegalArgumentException();
     if (layoutOrientation == orientation)
       return;
 


More information about the Classpath-patches mailing list