JDK-7007254 : A NullPointerException occurs with jvisualvm placed under a dir. including Japanese chars
  • Type: Bug
  • Component: hotspot
  • Sub-Component: jvmti
  • Affected Version: 6u23
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-12-16
  • Updated: 2011-07-29
  • Resolved: 2011-05-10
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7 Other
7Fixed hs21Fixed
Description
When a CU unfold JDK6u23 under a directory including Japanese characters in the directory path name, jvisualvm cause an exception in the target application and error dialogue appears.

CONFIGURATION:
OS : WindowsXP prof. (32bits, SP3, Japanese)
JDK : 6u23

REPRODUCE:

1. Unfold JDK6u23 under a directory including Japanese characters in the directory path name.
  ex. C:\\203e\203X\203g ("tesuto" in Japanese)
2. Invoke jvisualvm under C:\\203e\203X\203g\JDK6_23\bin
3. Open some java application.
  ex. java -jar Java2Demo.jar
4. Try to get profiles by clicking "CPU" or "Memory" button in profiler tab

In jvisualvm side, error dialog appears.(please see the attached error-dialog.JPG)
In the application side, the following exception occurs.

----
C:\utility\java\jdk6_21\demo\jfc\Java2D>java -jar Java2Demo.jar
Exception in thread "Attach Listener" java.lang.reflect.InvocationTargetExceptio
n
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(Instrumenta
tionImpl.java:323)
        at sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(Instrume
ntationImpl.java:348)
Caused by: java.lang.NullPointerException
        at org.netbeans.lib.profiler.server.ProfilerActivate15.getArchiveFile(Pr
ofilerActivate15.java:78)
        at org.netbeans.lib.profiler.server.ProfilerActivate15.activate(Profiler
Activate15.java:99)
        at org.netbeans.lib.profiler.server.ProfilerActivate15.agentmain(Profile
rActivate15.java:64)
        ... 6 more
Agent failed to start!
----

For more detail inf., please see the comment section.

Comments
EVALUATION http://hg.openjdk.java.net/jdk7/hotspot/hotspot/rev/fcc932c8238c
20-04-2011

EVALUATION http://hg.openjdk.java.net/jdk7/hotspot-rt/hotspot/rev/fcc932c8238c
16-04-2011

SUGGESTED FIX The fix seems to be simple: ----------------- diff --git a/src/share/vm/prims/jvmtiEnv.cpp b/src/share/vm/prims/jvmtiEnv.cpp --- a/src/share/vm/prims/jvmtiEnv.cpp +++ b/src/share/vm/prims/jvmtiEnv.cpp @@ -525,7 +525,7 @@ ObjectLocker ol(loader, THREAD); // need the path as java.lang.String - Handle path = java_lang_String::create_from_str(segment, THREAD); + Handle path = java_lang_String::create_from_platform_dependent_str(segment, THREAD); if (HAS_PENDING_EXCEPTION) { CLEAR_PENDING_EXCEPTION; return JVMTI_ERROR_INTERNAL; -------------------- Tested on Windows and it also works fine on Linux.
04-01-2011

EVALUATION ClassLoader.getSystemClassLoader().getResource("org/netbeans/lib/profiler/server/ProfilerActivate15.class") returns null because the jfluid-server-15.jar is added incorrectly to the system classloader classpath. The problem is in JvmtiEnv::AddToSystemClassLoaderSearch(), where parameter 'segment' is encoded in platform dependent encoding (on Windows and Solaris), but it is treated as UTF-8 when converted to java.lang.String object via call to java_lang_String::create_from_str(segment, THREAD).
04-01-2011