This patch (committed) adds an argument check to the setLayoutOrientation()
method:
2006-06-26 David Gilbert <[EMAIL PROTECTED]>
* javax/swing/JList.java
(setLayoutOrientation): Check for valid argument.
Regards,
Dave
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 [EMAIL PROTECTED]
#VERTICAL},
+ * [EMAIL PROTECTED] #VERTICAL_WRAP} and [EMAIL PROTECTED]
#HORIZONTAL_WRAP}. The default value
+ * is [EMAIL PROTECTED] #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 [EMAIL PROTECTED]
#VERTICAL},
+ * [EMAIL PROTECTED] #VERTICAL_WRAP} and [EMAIL PROTECTED] #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;