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

handling of null by DataFlavor(Class) constructor should be specified

XMLWordPrintable

    • sparc
    • solaris_2.5

      Name: mgC56079 Date: 05/26/99


      Constructor DataFlavor(Class, String), with null Class parameter, throws
      NullPointerException on jdk1.2.2 and passes without exceptions on jdk1.1.*.
      It may confuse users and cause incomatibility.
      Specification should explicitly define handling of the null parameter.
      ------------ Test.java
      import java.awt.datatransfer.*;
      public class Test {

          public static void main(String[] args) {
      try {
          DataFlavor df = new DataFlavor((Class)null, "");
      System.out.println("NPE was not thrown");
      } catch (NullPointerException e) {
      System.out.println("NPE was thrown");
      }
          }

      }
      ------------ Output on 1.1.8
      NPE was not thrown
      ------------ Output on 1.2.2
      NPE was thrown
      ------------
      ======================================================================

            denis Denis Fokin (Inactive)
            gorsunw Gor Gor (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: