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

TextFlavor.equals(String) ignores base mime type

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description



      Name: sdC67446 Date: 05/31/99


      The method
          public boolean equals(String mimeString)
      of class java.awt.datatransfer.TextFlavor
      ignores base mime type (primary mimetype + sub mimetype).

      The JDK javadoc comment says:
      --------------------------------------------------
          /**
           * Returns true if the MIME type is equal to the MIME type for
           * this <code>TextFlavor</code>. The types are considered equal
           * if the primary type, subtype, and charset parameter are all
           * equal. Representation class and parameters other than charset
           * are ignored. No default values are assumed.
           *
           */
          public boolean equals(String mimeString)

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

      public class Test {

          public static void main(String[] args) {
              try {
                  TextFlavor tf = new TextFlavor("text/plain");
                  String mimeString = "whatever/youwant";
                  System.out.println(tf.equals(mimeString));
              } catch (ClassNotFoundException e) {
                  e.printStackTrace();
              } catch (NullPointerException e1) {
                  e1.printStackTrace();
              }
          };
      }
      ---------Output-----------------------------------
      true
      --------------------------------------------------
      ======================================================================

        Attachments

          Activity

            People

            Assignee:
            ehawkessunw Eric Hawkes (Inactive)
            Reporter:
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: