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

REGRESSION: java.awt.datatransfer.DataFlavor constructors behavior changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P1 P1
    • 1.2.2
    • 1.1.1, 1.2.1
    • client-libs
    • 1.2.2
    • generic, x86, sparc
    • generic, solaris_2.6, windows_nt

      The DataFlavor(String) based constructors used to default the class=<javaclass>
      param to java.io.DataFlavor if none was specified. This default behavior is
      very useful when constructing a simple DataFlavor for an external MIME
      content type such as an e-mail attachment etc since such types typically
      would not be a DataFlavor, and they would typically be represented as an
      InputStream.

      Unfortunately the javadoc clashed with the implementation, and someone
      mindlessly changed the implementation to match the javadoc.

      I believe that this fix is inappropriate.



      tim.bell@Eng 1999-03-05
      An easy way to demonstrate this bug is to use the msgsend.java
      program in the javamail 1.1.1/demo directory:

      1) cd <wherever>/javamail-1.1.1/demo
      2) setenv CLASSPATH <wherever>/mail.jar:<wherever>/activation.jar:.
      3) javac msgsend.java
      4) java -Djava.compiler=NONE msgsend -s "BugId 4212613" -d user@host < /etc/motd

      The output will be:


      To: user@host
      Subject: BugId 4212613
      Exception in thread "main" java.lang.ExceptionInInitializerError: java.lang.IllegalArgumentException: no representation class specified for:text/plain
              at java.awt.datatransfer.DataFlavor.initialize(DataFlavor.java:335)
              at java.awt.datatransfer.DataFlavor.<init>(DataFlavor.java:250)
              at javax.activation.ActivationDataFlavor.<init>(ActivationDataFlavor.java:77)
              at com.sun.mail.handlers.text_plain.<clinit>(text_plain.java:33)
              at java.lang.Class.forName0(Native Method)
              at java.lang.Class.forName(Class.java:124)
              at javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:368)
              at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:617)
              at javax.activation.DataHandler.getInputStream(DataHandler.java:241)
              at javax.activation.DataHandlerDataSource.getInputStream(DataHandler.java:701)
              at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:99)
              at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:946)
              at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:1605)
              at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:1586)
              at javax.mail.Transport.send(Transport.java:72)
              at msgsend.<init>(msgsend.java:139)
              at msgsend.main(msgsend.java:29)

      This was observed using build J:

      % java -version ; java -fullversion
      java version "1.2.1"
      Classic VM (build JDK-1.2.1-J, green threads, sunwjit)
      java full version "JDK-1.2.1-J"

            prssunw Prs Prs (Inactive)
            lcablesunw Larry Cable (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: