This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 207945 - UriSyntaxException from ClassBytesLoader.readJar
Summary: UriSyntaxException from ClassBytesLoader.readJar
Status: RESOLVED INCOMPLETE
Alias: None
Product: profiler
Classification: Unclassified
Component: Engine (show other bugs)
Version: 7.0.1
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Hurka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-31 11:29 UTC by fglez.tsl
Modified: 2012-02-03 15:34 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fglez.tsl 2012-01-31 11:29:16 UTC
When there's a jar in the application classpath which includes non-URI (but valid) characters, an exception occurs. 

WebLogic Server includes several jar patches with brackets in their names, e.g. /bea/patch_wls1001/patch_jars/CR337395_1000mp1[0].jar

Trying to profile a WebLogic Server application, the exception produced is 

Exception in thread "main" java.lang.IllegalArgumentException
        at java.net.URI.create(URI.java:842)
        at org.netbeans.lib.profiler.server.ClassBytesLoader.readJar(ClassBytesLoader.java:160)
        at org.netbeans.lib.profiler.server.ClassBytesLoader.getClassFileBytes(ClassBytesLoader.java:99)
        at org.netbeans.lib.profiler.server.ProfilerInterface.classLoadHook(ProfilerInterface.java:892)
        at java.lang.Class.getDeclaredConstructors0(Native Method)
        at java.lang.Class.privateGetDeclaredConstructors(Class.java:2357)
        at java.lang.Class.getConstructor0(Class.java:2671)
        at java.lang.Class.newInstance0(Class.java:321)
        at java.lang.Class.newInstance(Class.java:303)
        at weblogic.descriptor.internal.DescriptorImpl.createObject(DescriptorImpl.java:389)
        at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalBindingType(UnmarshalResult.java:176)
        at com.bea.staxb.runtime.internal.UnmarshalResult.unmarshalDocument(UnmarshalResult.java:154)
        at com.bea.staxb.runtime.internal.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:65)
        at weblogic.descriptor.internal.MarshallerFactory$1.createDescriptor(MarshallerFactory.java:95)
        at weblogic.descriptor.BasicDescriptorManager.createDescriptor(BasicDescriptorManager.java:230)
        at weblogic.management.provider.internal.DescriptorManagerHelper.loadDescriptor(DescriptorManagerHelper.java:63)
        at weblogic.management.provider.internal.RuntimeAccessImpl$IOHelperImpl.parseXML(RuntimeAccessImpl.java:673)
        at weblogic.management.provider.internal.RuntimeAccessImpl.parseNewStyleConfig(RuntimeAccessImpl.java:258)
        at weblogic.management.provider.internal.RuntimeAccessImpl.<init>(RuntimeAccessImpl.java:114)
        at weblogic.management.provider.internal.RuntimeAccessService.start(RuntimeAccessService.java:38)
        at weblogic.t3.srvr.ServerServicesManager.startService(ServerServicesManager.java:378)
        at weblogic.t3.srvr.ServerServicesManager.startInStandbyState(ServerServicesManager.java:125)
        at weblogic.t3.srvr.T3Srvr.initializeStandby(T3Srvr.java:647)
        at weblogic.t3.srvr.T3Srvr.startup(T3Srvr.java:419)
        at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:377)
        at weblogic.Server.main(Server.java:67)
Caused by: java.net.URISyntaxException: Illegal character in path at index 51: file:/bea/patch_wls1001/patch_jars/CR337395_1000mp1[0].jar
        at java.net.URI$Parser.fail(URI.java:2816)
        at java.net.URI$Parser.checkChars(URI.java:2989)
        at java.net.URI$Parser.parseHierarchical(URI.java:3073)
        at java.net.URI$Parser.parse(URI.java:3021)
        at java.net.URI.<init>(URI.java:578)
        at java.net.URI.create(URI.java:840)
        ... 25 more
Comment 1 Tomas Hurka 2012-02-03 14:04:53 UTC
I am not able to reproduce it. In normal situation the path has correct URI characters. I tested it with profiling Java2Demo[1].jar and it worked fine, the path used was:
file:/tmp/Java2Demo%5b1%5d.jar

See below:
$ java -agentpath:/home/thurka/Projects/Source/nb-trunk/nbbuild/netbeans/profiler/lib/deployed/jdk16/linux-amd64/libprofilerinterface.so=/home/thurka/Projects/Source/nb-trunk/nbbuild/netbeans/profiler/lib,5140 -jar Java2Demo\[1\].jar 
Profiler Agent: Initializing...
Profiler Agent: Options: >/home/thurka/Projects/Source/nb-trunk/nbbuild/netbeans/profiler/lib,5140<
Profiler Agent: Initialized successfully
Profiler Agent: Waiting for connection on port 5140 (Protocol version: 12)
Profiler Agent: Established connection with the tool
Profiler Agent: Standard session
loading Jar URI:file:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/rt.jar
Profiler Agent: Redefining 100 classes at idx 0, out of total 542 
Profiler Agent: Redefining 100 classes at idx 100, out of total 542 
Profiler Agent: Redefining 100 classes at idx 200, out of total 542 
Profiler Agent: Redefining 100 classes at idx 300, out of total 542 
Profiler Agent: Redefining 100 classes at idx 400, out of total 542 
Profiler Agent: Redefining 42 classes at idx 500, out of total 542 
loading Jar URI:file:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/jsse.jar
loading Jar URI:file:/tmp/Java2Demo%5b1%5d.jar
Profiler Agent: Connection with agent closed
Profiler Agent: Connection with agent closed
$

Which JDK are you using? Since the URL is returned from ClassLoader.getSystemResource(), it could be JDK bug. Can you prepare test case, which will demonstrate the problem. Thanks.
Comment 2 fglez.tsl 2012-02-03 15:34:22 UTC
Environment is

java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) Server VM (build 1.5.0_22-b03, mixed mode)

SunOS xxx 5.10 Generic_144488-09 sun4us sparc FJSV,GPUZC-L

I'll try to prepare a test case. It's even possible that WebLogic classloaders could be involved.