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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P1
    • Resolution: Fixed
    • Affects Version/s: 1.1.1, 1.2.1
    • Fix Version/s: 1.2.2
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.2.2
    • CPU:
      generic, x86, sparc
    • OS:
      generic, solaris_2.6, windows_nt

      Description

      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"

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: