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

SystemFlavorMap addUnencodedNativeForFlavor() method adding extra encoded String

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.4.0
    • 1.4.0
    • client-libs
    • None
    • beta3
    • sparc
    • solaris_8
    • Verified

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

      This bug is nearly identical to fixed bug 4478912. The difference is that this bug occurs for method addUnencodedNativeForFlavor() instead of setNativesForFlavor().

      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 addUnencodedNativeForFlavor() method, establish new mapping(s) using the same set of String natives used by the existing DataFlavor. So in most cases addUnencodedNativeForFlavor() will be called many times.
      - 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.Reader; charset=Unicode
      **** Modified DataFlavor: text/plain-test; class=java.io.Reader; charset=Unicode
      ****
      ****
      **** 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. Also, the encoded String native is the first item indicating most preferred native.

      Steps to reproduce:
      ------------------
      The test case AddNative.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 AddNative >myoutput

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

      Other information:
      -----------------
      - This bug first appeared in 1.4.0-beta_refresh-b70
      - The bug occurs on all platforms

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: