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

unclear spec for java.awt.datatransfer.DataFlavor ctors

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.5
    • Verified



      Name: sdC67446 Date: 08/10/98


      The spec for
          DataFlavor(String primaryType,
                     String subType,
                     MimeTypeParameterList params,
                     Class representationClass,
                     String humanPresentableName),

          DataFlavor(Class representationClass,
                     String humanPresentableName),

          DataFlavor(String mimeType,
                     String humanPresentableName)

      doesn't specify behavior if parameter 'humanPresentableName' == null.
      Currently ctors accept null values, but consequent call of
      getHumanPresentableName() returns 'primaryType'+"/"+'subType'.

      The doc says:
      -------------------------------------------------------------
      public DataFlavor(String primaryType,
                        String subType,
                        MimeTypeParameterList params,
                        Class representationClass,
                        String humanPresentableName)

            Construct a fully specified DataFlavor
      ------------------------------------------------------------
      The test demonstrating the bug:

      import java.awt.datatransfer.*;
      public class Test {

        public static void main(String[] args) {
             
          String mimeType = "application/postscript; class=java.lang.Integer";
          String humanPresentableName = null;
          DataFlavor df = new DataFlavor(mimeType,humanPresentableName);
          System.out.println("-"+df.getHumanPresentableName());

        }
      }
      ------------------------------------------------------------
      Test's output:
      -application/postscript


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

            dgreensunw Dale Green (Inactive)
            sdmitriesunw Sergei Dmitriev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: