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

javax.swing.SpinnerListModel(List) constructor has incorrect behaviour

    Details

      Description



      Name: ooR10001 Date: 12/28/2000


      javax.swing.SpinnerListModel(List) constructor has incorrect behaviour becuase it does
      not throw IllegalArgumentException when passed argument is null or has zero length.

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

      public SpinnerListModel(List values)

            Construct a SpinnerModel whose sequence of values is defined by the
            specified List. The intial value (current element) of the model will
            be values.get(0). If values is null or has zero size then an
            IllegalArgumentException is thrown.
      ----------------------------------------------

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

      public class test {

        public static void main(String[] args) {
          String status = "FAILED";
          try {
              SpinnerListModel model = new SpinnerListModel((List)null);
          } catch (IllegalArgumentException npe) {
              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: