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

DataFlavor.clone() throws NullPointerException

XMLWordPrintable

    • 1.2.2
    • sparc
    • solaris_2.5



      Name: sdC67446 Date: 10/15/98


      The method DataFlavor.clone() throws NullPointerException
      if class instance was created with constructor DataFlavor().

      The doc says:
      --------------------------------------------------
      public Object clone()
                            throws CloneNotSupportedException

            Returns:
                  a clone of this DataFlavor
            Overrides:
                  clone in class Object

      The test demonstrating the bug:
      -----------------Test.java------------------------
      import java.awt.datatransfer.*;

      public class Test {
        public static void main(String[] args) {
          try {
              DataFlavor df1 = new DataFlavor();
              Object df2 = df1.clone();
          } catch (CloneNotSupportedException e) {
              System.out.println("unexpected exception: "+e);
          }
        }
      }
      ---------Output from the test---------------------
      Exception in thread "main" java.lang.NullPointerException
              at java.awt.datatransfer.DataFlavor.clone(Compiled Code)
              at Test.main(Compiled Code)
      --------------------------------------------------
      ======================================================================

            xdengsunw Xianfa Deng (Inactive)
            sdmitriesunw Sergei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: