Hello,
I would like to as for review of the fix for CR7007254 - A NullPointerException 
occurs with jvisualvm placed under a dir. including Japanese chars.

Webrev: http://cr.openjdk.java.net/~thurka/7007254/webrev.00/

Note: To reproduce the issue, path to jfluid-server-15.jar must contain 
Japanese characters.

Details:
jfluid-server-15.jar is javaagent library loaded into target JVM via Attach 
API. It calls 
ClassLoader.getSystemClassLoader().getResource("org/netbeans/lib/profiler/server/ProfilerActivate15.class")
 as part of agentmain method. 
org/netbeans/lib/profiler/server/ProfilerActivate15.class is part of 
jfluid-server-15.jar, but ClassLoader.getSystemClassLoader().getResource("...") 
returns null because 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). I tested the the fix on 
Windows. It also works on Linux, even though the 'segment' is encoded in UTF-8, 
probably because on Linux native encoding is UTF-8 anyway. Maybe it would be 
useful to unify encoding of Attach API command and arguments and use platform 
dependent encoding on all platforms. Currently the encoding for Windows is done 
via JNU_GetStringPlatformChars in 
jdk/src/windows/native/sun/tools/attach/WindowsVirtualMachine.c in method 
Java_sun_tools_attach_WindowsVirtualMachine_enqueue for Solaris in 
jdk/src/solaris/native/sun/tools/attach/SolarisVirtualMachine.c in method 
Java_sun_tools_attach_SolarisVirtualMachine_enqueue. The Linux part is done 
differently at sun.tools.attach.LinuxVirtualMachine.execute() and encodes 
Attach API command and arguments in UTF-8.

Thanks,
--
Tomas Hurka   <mailto:tomas.hu...@oracle.com>
NetBeans Profiler http://profiler.netbeans.org
VisualVM http://visualvm.dev.java.net
Software Developer
Oracle, Praha Czech Republic

Reply via email to