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

SystemFlavorMap setNativesForFlavor() method adding extra encoded String native

XMLWordPrintable

    • beta2
    • sparc
    • solaris_8
    • Verified

      In some cases the SystemFlavorMap method setNativesForFlavor() will add an additional encoded String native to the assigned native mappings.

      The bug has occured in a stress test case that does the following:

      - Aquires all existing DataFlavors from the SystemFlavorMap.
      - For each of these DataFlavors, the test will create a new DataFlavor by slightly modifying the MIME type of the existing DataFlavor. For example,
      Original MimeType: "text/plain; class=java.io.Reader; charset=Unicode"
      Modified MimeType: "text/plain-TEST; class=java.io.Reader; charset=Unicode"
      - Then using setNativesForFlavor() method, establish a new mapping using the same set(Array) of String natives used by the existing DataFlavor.
      - The test will then request back the mappings with getNativesForFlavor() method and compare to the original set(Array).

      Here's an example output from a failing test case:

      **** Original DataFlavor: text/plain; class=java.io.InputStream; charset=UTF-16LE
      **** Modified DataFlavor: text/plain-test; class=java.io.InputStream; charset=UTF-16LE
      ****
      ****
      **** TEST FAILS


      **** Printing original set of mappings

      *** Printing all String Natives
      *** Size = 3

      COMPOUND_TEXT
      TEXT
      STRING


      **** Printing newly assigned mappings from SystemFlavorMap

      *** Printing all String Natives
      *** Size = 4

      JAVA_DATAFLAVOR:text/plain-test; class=java.io.InputStream
      COMPOUND_TEXT
      TEXT
      STRING

      -----
      In the above example, there was an additional encoded String native that was added, and it was not in the original set.

      Steps to reproduce:
      ------------------
      The test case AddNativeTest.java is attached to the bug report. It just needs to be compiled and run. The test generates a lot of output so it is convenient to redirect to a file.

      java AddNativeTest >myoutput

      The test output will indicate a pass or fail for each DataFlavor. In most cases, the test will fail.

      Other information:
      -----------------
      - This bug first appeared in 1.4.0-beta_refresh-b70
      - The bug occurs on all platforms
      - The bug also occurs if the mappings are assigned with addUnencodedNativeForFlavor() method.

            dassunw Das Das (Inactive)
            rreynagasunw Rick Reynaga (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: