United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-7007254 A NullPointerException occurs with jvisualvm placed under a dir. including Japanese chars
JDK-7007254 : A NullPointerException occurs with jvisualvm placed under a dir. including Japanese chars

Details
Type:
Bug
Submit Date:
2010-12-16
Status:
Closed
Updated Date:
2011-07-29
Project Name:
JDK
Resolved Date:
2011-05-10
Component:
hotspot
OS:
windows_xp
Sub-Component:
jvmti
CPU:
x86
Priority:
P3
Resolution:
Fixed
Affected Versions:
6u23
Fixed Versions:
hs21 (b10)

Related Reports
Backport:

Sub Tasks

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

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).
                                     
2011-01-04
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.
                                     
2011-01-04
EVALUATION

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

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



Hardware and Software, Engineered to Work Together