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

DataFlavor.normalizeMimeTypeParameter works wrong

XMLWordPrintable

    • kestrel
    • sparc
    • solaris_2.5.1



      Name: sdC67446 Date: 08/09/99


      The method:
          protected String
              normalizeMimeTypeParameter(String parameterName,
                                         String parameterValue)
      of class java.awt.datatransfer.DataFlavor
      returns 'parameterName'+"="+'parameterValue'.
      Should return only the (normalized) 'parameterValue'.
      Also the doc should specify the rules of normalizing
      the 'parameterValue'.

      The same problem (with doc) is in the method:
          protected String normalizeMimeType(String mimeType)
      Currently this method returns unchanged 'mimeType'.

      The doc says:
      --------------------------------------------------
      protected String normalizeMimeTypeParameter(String parameterName,
                                                  String parameterValue)

           Deprecated.

           Called on DataFlavor for every MIME Type parameter to allow
           DataFlavor subclasses to handle special parameters like the
           text/plain charset parameters, whose values are case
           insensitive. (MIME type parameter values are supposed to be case
           sensitive.

           This method is called for each parameter name/value pair and
           should return the normalized representation of the parameterValue
           This method is never invoked by this implementation from 1.1
           onwards

      protected String normalizeMimeType(String mimeType)

           Deprecated.

           Called for each MIME type string to give DataFlavor subtypes the
           opportunity to change how the normalization of MIME types is
           accomplished. One possible use would be to add default
           parameter/value pairs in cases where none are present in the MIME
           type string passed in This method is never invoked by this
           implementation from 1.1 onwards

      ---------Test.java--------------------------------
      import java.awt.datatransfer.DataFlavor;

      public class Test extends DataFlavor {
          public String normalizeMimeType(String mimeType) {
              return super.normalizeMimeType(mimeType);
          }
          public String normalizeMimeTypeParameter(String parameterName,
                                                   String parameterValue) {
              return super.normalizeMimeTypeParameter(parameterName, parameterValue);
          }
          public static void main(String[] args) {
              Test df = new Test();
              System.out.println("normalizeMimeTypeParameter: "+
                                 df.normalizeMimeTypeParameter("WhatEver","YouWant"));
              System.out.println("normalizeMimeType: "+
                                 df.normalizeMimeType("Left/Right"));
          }
      }
      ---------Output-----------------------------------
      Warning: JIT compiler "sunwjit" not found. Will use interpreter.
      normalizeMimeTypeParameter: WhatEver=YouWant
      normalizeMimeType: Left/Right
      --------------------------------------------------
      ======================================================================

            prssunw Prs Prs (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: