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 250808

Summary: NPE in ClassManager.storeClassBytesForCustomLoaderClasses
Product: profiler Reporter: Jiri Sedlacek <jis>
Component: EngineAssignee: Tomas Hurka <thurka>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.1   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Jiri Sedlacek 2015-03-02 09:57:13 UTC
Dynamic attach to a running NetBeans instance, CPU all (sampled), detach, re-attach for 1 selected method (instrumented) "org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run()", the following is thrown and both profiling and profiled IDEs stop responding:

java.lang.NullPointerException
	at org.netbeans.lib.profiler.instrumentation.ClassManager.storeClassFileBytesForCustomLoaderClasses(ClassManager.java:284)
	at org.netbeans.lib.profiler.instrumentation.RecursiveMethodInstrumentor1.preGetInitialMethodsToInstrument(RecursiveMethodInstrumentor1.java:525)
	at org.netbeans.lib.profiler.instrumentation.RecursiveMethodInstrumentor1.getInitialMethodsToInstrument(RecursiveMethodInstrumentor1.java:96)
	at org.netbeans.lib.profiler.instrumentation.Instrumentor.createInitialInstrumentMethodGroupResponseForCallGraph(Instrumentor.java:448)
	at org.netbeans.lib.profiler.instrumentation.Instrumentor.createInitialInstrumentMethodGroupResponse(Instrumentor.java:297)
	at org.netbeans.lib.profiler.ProfilerClient.instrumentMethodGroupFromRoot(ProfilerClient.java:1925)
	at org.netbeans.lib.profiler.ProfilerClient.access$200(ProfilerClient.java:89)
[catch] at org.netbeans.lib.profiler.ProfilerClient$SeparateCmdExecutionThread.run(ProfilerClient.java:120)
Comment 1 Tomas Hurka 2015-03-12 07:02:20 UTC
Missing part of steps is that running NetBeans instance must run another java application via ant.
Problem is caused by ugly hack (#46171) in ant infrastructure, which changes content of "java.class.path" system property. Profiler uses "java.class.path" system property to search for classes loaded by system classloader. Of course changing this property, after JVM starts, does not affect system classloader in any way, so the profiler is searching for system classloader classes in the wrong classpath.
Comment 2 Tomas Hurka 2015-03-12 09:28:51 UTC
Fixed in profiler-main

changeset:   284596:e8f7177a362e
user:        Tomas Hurka <thurka@netbeans.org>
date:        Thu Mar 12 10:27:49 2015 +0100
summary:     invoke setInterface() only for vm-supplied classes