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

DataFlavor.getTextPlainUnicodeFlavor returns flavor w null charset

XMLWordPrintable

    • beta
    • sparc
    • solaris_7
    • Verified



      Name: sdR10048 Date: 01/24/2001


      Method
      public static final java.awt.datatransfer.DataFlavor
         getTextPlainUnicodeFlavor()

      returns flavor with null charset
      that is different of what javadoc says:
      --------------------------------------------------
          /**
           * Returns a <code>DataFlavor</code> representing plain text with Unicode
           * encoding, where:
           * <pre>
           * representationClass = java.io.InputStream
           * mimeType = "text/plain;
           * charset=<platform default Unicode encoding>"
           * </pre>
           * The Win32 Sun implementations use the encoding <code>utf-16le</code>.
           * The Solaris and Linux Sun implementations use the encoding
           * <code>iso-10646-ucs-2</code>.
           *
           * @return a <code>DataFlavor</code> representing plain text
           * with Unicode encoding
           */
          public static final DataFlavor getTextPlainUnicodeFlavor() {

      See example:
      --------------------------------------------------
      dsv@falcon ~/tmp
      % cat Test.java
      import java.awt.datatransfer.*;
      public class Test {
          public static void main(String[] args) {
              DataFlavor df = DataFlavor.getTextPlainUnicodeFlavor();
              System.out.println(df);
              System.out.println("charset=" +
                                 df.getParameter("charset"));
          }
      }

      dsv@falcon ~/tmp
      % java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b48)
      Java HotSpot(TM) Client VM (build 1.4beta-B48, mixed mode)

      dsv@falcon ~/tmp
      % javac Test.java
      java Test

      dsv@falcon ~/tmp
      % java Test
      cajava.awt.datatransfer.DataFlavor[representationclass=java.io.InputStream;mimetype=text/plain]
      charset=null

      NOTE: the same thing on jdk 1.3:
      --------------------------------------------------
      dsv@falcon ~/tmp
      % java -version
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, interpreted mode)

      dsv@falcon ~/tmp
      % java Test
      java.awt.datatransfer.DataFlavor[representationclass=java.io.InputStream;mimetype=text/plain]
      charset=iso-10646-ucs-2
      ^C
      --------------------------------------------------
      This causes to fail folowing jck merlin test:
      api/java_awt/datatransfer/DataFlavor/index.html#rclass[DataFlavor2010]
      At this time (1/24/2001) updated version of this test is not in CUP
      merlin workspace.
      ======================================================================

            dmendenhsunw David Mendenhall (Inactive)
            dsvsunw Dsv Dsv (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: