This patch (committed) adds an argument check to a couple of methods in the Timer class, which fixes a few failing tests in the Intel test suite:

2006-07-09  David Gilbert  <[EMAIL PROTECTED]>

        * javax/swing/Timer.java
        (setDelay): Throw IllegalArgumentException for negative delay,
        (setInitialDelay): Likewise,
        * javax/swing/ToolTipManager.java
        (setInitialDelay): Document IllegalArgumentException,
        (setDismissDelay): Likewise,
        (setReshowDelay): Likewise.

Regards,

Dave
Index: javax/swing/Timer.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/Timer.java,v
retrieving revision 1.26
diff -u -r1.26 Timer.java
--- javax/swing/Timer.java      14 Feb 2006 22:36:07 -0000      1.26
+++ javax/swing/Timer.java      9 Jul 2006 20:48:23 -0000
@@ -1,5 +1,5 @@
 /* Timer.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.
 
@@ -264,9 +264,13 @@
    * firing the first event.
    *
    * @param d The time gap between the subsequent events, in milliseconds
+   * 
+   * @throws IllegalArgumentException if <code>d</code> is less than zero.
    */
   public void setDelay(int d)
   {
+    if (d < 0) 
+      throw new IllegalArgumentException("Invalid delay: " + d);
     delay = d;
   }
 
@@ -287,9 +291,13 @@
    * subsequent events.
    *
    * @param i the initial delay, in milliseconds
+   * 
+   * @throws IllegalArgumentException if <code>i</code> is less than zero.
    */
   public void setInitialDelay(int i)
   {
+    if (i < 0)
+      throw new IllegalArgumentException("Invalid initial delay: " + i);
     initialDelay = i;
   }
 
Index: javax/swing/ToolTipManager.java
===================================================================
RCS file: /sources/classpath/classpath/javax/swing/ToolTipManager.java,v
retrieving revision 1.32
diff -u -r1.32 ToolTipManager.java
--- javax/swing/ToolTipManager.java     14 Feb 2006 22:36:07 -0000      1.32
+++ javax/swing/ToolTipManager.java     9 Jul 2006 20:48:24 -0000
@@ -1,5 +1,5 @@
 /* ToolTipManager.java --
-   Copyright (C) 2002, 2004 Free Software Foundation, Inc.
+   Copyright (C) 2002, 2004, 2006, Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -267,10 +267,12 @@
   }
 
   /**
-   * This method sets the initial delay before the ToolTip is shown when the
+   * Sets the initial delay before the ToolTip is shown when the
    * mouse enters a Component.
    *
    * @param delay The initial delay before the ToolTip is shown.
+   * 
+   * @throws IllegalArgumentException if <code>delay</code> is less than zero.
    */
   public void setInitialDelay(int delay)
   {
@@ -289,9 +291,11 @@
   }
 
   /**
-   * This method sets the time the ToolTip will be shown before being hidden.
+   * Sets the time the ToolTip will be shown before being hidden.
    *
-   * @param delay The time the ToolTip will be shown before being hidden.
+   * @param delay  the delay (in milliseconds) before tool tips are hidden.
+   * 
+   * @throws IllegalArgumentException if <code>delay</code> is less than zero.
    */
   public void setDismissDelay(int delay)
   {
@@ -310,10 +314,12 @@
   }
 
   /**
-   * This method sets the amount of delay where if the mouse re-enters a
+   * Sets the amount of delay where if the mouse re-enters a
    * Component, the tooltip will be shown immediately.
    *
-   * @param delay The reshow delay.
+   * @param delay The reshow delay (in milliseconds).
+   * 
+   * @throws IllegalArgumentException if <code>delay</code> is less than zero.
    */
   public void setReshowDelay(int delay)
   {

Reply via email to