Hi guys, On Mon, 2006-01-30 at 14:24 +0000, David Gilbert wrote: > Roman Kennke wrote: > >Testing this it seems that (at least in JDK1.5) the orientation value is > >indeed restricted to 0 and 1 (the constants that are defined for the > >orientation). JDK1.5 throws IllegalArgumentExceptions for all other > >values. I would suggest to follow the JDK there. > > > The Mauve police will get Mark anyway, because there is a test to cover > this...
OK, OK :)
We won't be liberal in what we expect:
2006-01-30 Mark Wielaard <[EMAIL PROTECTED]>
* javax/swing/JProgressBar.java (JProgressBar(int)): Document
IllegalArgumentException when orientation is illegal.
(JProgressBar(int, int, int)): Likewise and throw exception.
(setOrientation): Likewise.
And I actually ran mauve this time.
Will fix the broken app then.
Sorry for the noise.
Committed,
Mark
Index: javax/swing/JProgressBar.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/JProgressBar.java,v
retrieving revision 1.16
diff -u -r1.16 JProgressBar.java
--- javax/swing/JProgressBar.java 30 Jan 2006 13:50:29 -0000 1.16
+++ javax/swing/JProgressBar.java 30 Jan 2006 14:53:36 -0000
@@ -1,5 +1,5 @@
/* JProgressBar.java --
- Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -208,9 +208,10 @@
* Creates a new JProgressBar object with a minimum of 0,
* a maximum of 100, and the given orientation.
*
- * @param orientation The orientation of the JProgressBar. Can be either
- * [EMAIL PROTECTED] #HORIZONTAL} or [EMAIL PROTECTED] #VERTICAL}. Defaults to
- * <code>HORIZONTAL</code> when any other value is given.
+ * @param orientation The orientation of the JProgressBar.
+ *
+ * @throws IllegalArgumentException if <code>orientation</code> is not either
+ * [EMAIL PROTECTED] #HORIZONTAL} or [EMAIL PROTECTED] #VERTICAL}.
*/
public JProgressBar(int orientation)
{
@@ -235,18 +236,18 @@
*
* @param minimum The minimum of the JProgressBar.
* @param maximum The maximum of the JProgressBar.
- * @param orientation The orientation of the JProgressBar. Can be either
- * [EMAIL PROTECTED] #HORIZONTAL} or [EMAIL PROTECTED] #VERTICAL}. Defaults to
- * <code>HORIZONTAL</code> when any other value is given.
+ * @param orientation The orientation of the JProgressBar.
+ *
+ * @throws IllegalArgumentException if <code>orientation</code> is not either
+ * [EMAIL PROTECTED] #HORIZONTAL} or [EMAIL PROTECTED] #VERTICAL}.
*/
public JProgressBar(int orientation, int minimum, int maximum)
{
model = new DefaultBoundedRangeModel(minimum, 0, minimum, maximum);
if (orientation != HORIZONTAL && orientation != VERTICAL)
- this.orientation = HORIZONTAL;
- else
- this.orientation = orientation;
- setOrientation(orientation);
+ throw new IllegalArgumentException(orientation
+ + " is not a legal orientation");
+ this.orientation = orientation;
changeListener = createChangeListener();
model.addChangeListener(changeListener);
updateUI();
@@ -315,14 +316,15 @@
* This method changes the orientation property. The orientation of the
* JProgressBar can be either horizontal or vertical.
*
- * @param orientation The orientation of the JProgressBar. Can be either
- * [EMAIL PROTECTED] #HORIZONTAL} or [EMAIL PROTECTED] #VERTICAL}. Defaults to
- * <code>HORIZONTAL</code> when any other value is given.
+ * @param orientation The orientation of the JProgressBar.
+ * @throws IllegalArgumentException if <code>orientation</code> is not
+ * either [EMAIL PROTECTED] #HORIZONTAL} or [EMAIL PROTECTED] #VERTICAL}.
*/
public void setOrientation(int orientation)
{
if (orientation != VERTICAL && orientation != HORIZONTAL)
- orientation = HORIZONTAL;
+ throw new IllegalArgumentException(orientation
+ + " is not a legal orientation");
if (this.orientation != orientation)
{
int oldOrientation = this.orientation;
signature.asc
Description: This is a digitally signed message part
