Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4181977

DefaultBoundedRangeModel(..) constructor doesn't throw IllegalArgumentException

XMLWordPrintable

    • 1.2.2
    • sparc
    • solaris_2.5.1
    • Verified



      Name: aaC67449 Date: 10/16/98


      DefaultBoundedRangeModel(int newValue,int newExtent,int newMin,int newMax) constructor doesn't throw IllegalArgumentException when called with negative extent, but creates an object with an inconsistent state instead

      javadoc says:"
      DefaultBoundedRangeModel

      public DefaultBoundedRangeModel(int value,
                                      int extent,
                                      int min,
                                      int max)

            Initializes value, extent, minimum and maximum. Adjusting is false. Throws an IllegalArgumentException if the following constraints aren't satisfied:

             min <= value <= value+extent <= max
             
      "

      see example:
      -------------- Example ------------

      public class Test extends JApplet{

         public static void main(String argv[]) {

           try {
             DefaultBoundedRangeModel c = new DefaultBoundedRangeModel(0,-10,0,100);
          
             System.out.println("FAILED: !(value <= value+extent)");

             System.out.println(" value extent min max");
             System.out.println("Is: "
                                                  +c.getValue()+" "
                                                  +c.getExtent()+" "
                                                  +c.getMinimum()+" "
                                                  +c.getMaximum());
                        
          } catch(IllegalArgumentException iae) { // Test no exceptions thr
                System.out.println("PASSED");
          }
            
        }

      }
      --------------- output----------
      FAILED: !(value <= value+extent)
                 value extent min max
      Is: 0 -10 0 100



      ======================================================================

            sswingtrsunw Swingtraq Swingtraq (Inactive)
            aalievsunw Artem Aliev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: