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

javax.swing.SpinnerListModel(Object[]) constructor has incorrect behaviour

    Details

    • Subcomponent:
    • Resolved In Build:
      beta
    • CPU:
      sparc
    • OS:
      solaris_2.6

      Description



      Name: ooR10001 Date: 12/15/2000


      javax.swing.SpinnerListModel(Object[]) constructor has incorrect behaviour because
      it doesn't throw IllegalArgumentException when argument is null or has zero length.

      The javadoc says:
      ----------------------
      SpinnerListModel

      public SpinnerListModel(Object[] values)

            Construct a SpinnerModel whose sequence of values is defined by the
            specified array. The intial value of the model will be values[0].
            If values is null or has zero length then an IllegalArugmentException
            is thrown.
      ----------------------------------------------

      Following test is demonstrate this bug:
      ----------------------------------------------
      import javax.swing.SpinnerListModel;

      public class test {

        public static void main(String[] args) {
          String status = "FAILED";
          try {
              SpinnerListModel model = new SpinnerListModel(new Object[] {});
          } catch (NullPointerException npe) {
              status = "OKAY";
          } catch (IllegalArgumentException iae) {
              status = "OKAY";
          }
          System.out.println(status);
        }

      }
      ----------------------
      Test output:
      ----------------------
      FAILED
      ----------------------

      This needs to be fixed.

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                svioletsunw Scott Violet (Inactive)
                Reporter:
                oovsunw Oov Oov (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: