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

DataFlavor(String) doesn't throw IllegalArgumentException

    Details

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

      Description



      Name: sdC67446 Date: 09/15/98


      The constructor DataFlavor(String mimeType) doesn't throw
      IllegalArgumentException if input param doesn't specify class.

      The doc says:
      --------------------------------------------------
      public DataFlavor(java.lang.String mimeType)
                 throws java.lang.ClassNotFoundException

            construct a DataFlavor from a Mime Type string.
            The string must specify a "class=" parameter in order
            to succeed in constructing a DataFlavor.
            Parameters:
              mimeType - the string used to identify the MIME type
                         for this flavor. If the the mimeType does not
                         specify a "class=" parameter, or if the class is
                         not successfully loaded, then an
                         IllegalArgumentException is thrown.

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

      public class Test {

        public static void main(String[] args) {
             
            DataFlavor df = null;
            try {
      System.out.println("1/");
      df = new DataFlavor("application/postscript");
            } catch (Exception e) {
      System.out.println(e);
            }
            try {
      System.out.println("2/");
      df = new DataFlavor("application/postscript;class=java.nowhere.Nobody");
            } catch (Exception e) {
      System.out.println(e);
            }
            try {
      System.out.println("3/");
      df = new DataFlavor("application/postscript;class=");
            } catch (Exception e) {
      System.out.println(e);
            }
        }
      }
      ---------Output from the test---------------------
      1/
      2/
      java.lang.ClassNotFoundException: java.nowhere.Nobody
      3/
      java.lang.IllegalArgumentException: failed to parse:application/postscript;class=
      --------------------------------------------------

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

        Attachments

          Activity

            People

            • Assignee:
              prssunw Prs Prs (Inactive)
              Reporter:
              sdmitriesunw Sergei Dmitriev (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: