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

incorrect ReleaseStringCritical() in JNI, displaying Arabic menus in Windows L&F

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Cannot Reproduce
    • Affects Version/s: 5.0
    • Fix Version/s: None
    • Component/s: client-libs
    • Subcomponent:
      2d
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      Name: gm110360 Date: 07/13/2004


      FULL PRODUCT VERSION :
      java version "1.5.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-32c)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      There seems to exist a memory resource leakage in the Windows Look&Feel, when displaying native menus for Swing (and possibly other Swing elements as well) if the string contains Arabic characters.

      It seems that the Arabic shaping engine for Java interacts with the Windows menu item constructions, and the JNI interface that reads the string to display and passed by Swing is improperly released by a call to ReleaseStringCritical() instead of ReleaseString() or ReleaseStringUTF().

      This does not cause a fatal error, the menu is correctly displayed, and the Java VM detects this incorrect call in the JNI dll, but I suspect a resource leakage, which may become critical if this also happens in applications translated to Arabic that display a lot of strings in Swing components.

      This warning is only visible in Java 1.5.0-Beta1, but not in Java 1.3.1 to 1.4.2 (may be this error is not checked in these release versions, and it may cause more desastrous results).

      I can see it when using the -Xcheck:jni parameter when launching Java.
      If this is caused by a new check, then it's great, but it indicates a bug in the JVM DLL that interfaces Swing with the native Windows Look and Feel.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      - Create a basic Swing application with a localizable menu.
      - Add some arabic menu items.
      - Make the application use the native Windows Look and Feel.
      - Launch the application from the console on Windows with java -Xcheck:jni.
      - Then click on the menu to display the Arabic menu item: the warning appears once.
      - navigate the mouse on the Arabic menu item: the warning is displayed each time the item is highlighted/unhighlighted.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      No such warning should appear (there's no such warning when displaying Latin, or Han or Hiragana/Katakana).
      This also occurs in any native system locale (at least for Windows English, French, Japanese, Arabic).

      Note: I did not check completely if this is a regression with Java 1.4.1 or 1.4.2. You need to use the -Xcheck:jni to see this warning.

      ACTUAL -
      The following warning is displayed on the console:

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Warning: Calling other JNI functions in the scope of Get/ReleasePrimitiveArrayCritical or Get/ReleaseStringCritical

      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      No work around. This bug seems related to the complex text shaping needed to display Arabic, between its internal UTF-16 representation in Java String instances, and Windows.
      This bug does not seem critical, but I suspect resource leakage in the JNI interface to the Windows Look and Feel.
      (Incident Review ID: 275438)
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dougfelt Doug Felt
                Reporter:
                gmanwanisunw Girish Manwani (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: