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 58402 - NPE from NbModuleProject.java:606
Summary: NPE from NbModuleProject.java:606
Status: VERIFIED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Project (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-28 14:13 UTC by Adam Sotona
Modified: 2005-11-22 09:57 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
stack trace of the exception (10.77 KB, text/plain)
2005-05-03 11:19 UTC, Adam Sotona
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adam Sotona 2005-04-28 14:13:14 UTC
java.lang.NullPointerException
	at
org.netbeans.modules.javacore.classpath.MergedClassPathImplementation.addResources(MergedClassPathImplementation.java:367)
	at
org.netbeans.modules.javacore.classpath.MergedClassPathImplementation.addClassPathResources(MergedClassPathImplementation.java:354)
	at
org.netbeans.modules.javacore.classpath.MergedClassPathImplementation.addClassPath(MergedClassPathImplementation.java:293)
	at
org.netbeans.modules.javacore.classpath.MergedClassPathImplementation.updateEntries(MergedClassPathImplementation.java:248)
	at
org.netbeans.modules.javacore.classpath.MergedClassPathImplementation.access$200(MergedClassPathImplementation.java:36)
	at
org.netbeans.modules.javacore.classpath.MergedClassPathImplementation$2.pathsAdded(MergedClassPathImplementation.java:75)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:324)
	at
org.openide.util.WeakListenerImpl$ProxyListener.invoke(WeakListenerImpl.java:415)
	at $Proxy6.pathsAdded(Unknown Source)
	at
org.netbeans.api.java.classpath.GlobalPathRegistry.register(GlobalPathRegistry.java:176)
	at
org.netbeans.modules.apisupport.project.NbModuleProject$OpenedHook.projectOpened(NbModuleProject.java:606)
	at
org.netbeans.spi.project.ui.ProjectOpenedHook$1.projectOpened(ProjectOpenedHook.java:49)
	at
org.netbeans.modules.project.ui.OpenProjectList.notifyOpened(OpenProjectList.java:404)
	at
org.netbeans.modules.project.ui.OpenProjectList.getDefault(OpenProjectList.java:121)
	at
org.netbeans.modules.project.ui.OpenProjectsTrampolineImpl.<init>(OpenProjectsTrampolineImpl.java:35)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
	at java.lang.Class.newInstance0(Class.java:308)
	at java.lang.Class.newInstance(Class.java:261)
	at
org.openide.util.lookup.MetaInfServicesLookup$P.getInstance(MetaInfServicesLookup.java:406)
	at org.openide.util.lookup.AbstractLookup.lookup(AbstractLookup.java:325)
	at org.openide.util.lookup.ProxyLookup.lookup(ProxyLookup.java:145)
	at
org.netbeans.modules.project.uiapi.Utilities.getOpenProjectsTrampoline(Utilities.java:45)
	at org.netbeans.api.project.ui.OpenProjects.<init>(OpenProjects.java:52)
	at org.netbeans.api.project.ui.OpenProjects.<clinit>(OpenProjects.java:47)
	at
org.netbeans.modules.editor.bookmarks.EditorBookmarksModule.restored(EditorBookmarksModule.java:71)
	at org.netbeans.core.modules.NbInstaller.loadCode(NbInstaller.java:317)
	at org.netbeans.core.modules.NbInstaller.load(NbInstaller.java:235)
	at org.netbeans.core.modules.ModuleManager.enable(ModuleManager.java:877)
	at org.netbeans.core.modules.ModuleList.installNew(ModuleList.java:382)
	at org.netbeans.core.modules.ModuleList.trigger(ModuleList.java:316)
	at org.netbeans.core.modules.ModuleSystem.restore(ModuleSystem.java:248)
	at org.netbeans.core.NonGui.run(NonGui.java:356)
	at org.netbeans.core.Main.run(Main.java:185)
	at org.netbeans.core.NbTopManager.getNbTopManager(NbTopManager.java:241)
	at org.netbeans.core.NbTopManager.get(NbTopManager.java:190)
	at org.netbeans.core.Main.start(Main.java:311)
	at org.netbeans.core.TopThreadGroup.run(TopThreadGroup.java:90)
Comment 1 Jesse Glick 2005-04-28 16:26:22 UTC
No steps to reproduce or info about what modules were open etc.

Well the actual exception is from javacore, not apisupport/project. From looking
at MCPI it seems that some SFBQ.Result is returning an array containing nulls -
whether this Result is directly coming from apisupport/project, from javacore,
or from somewhere else, I don't know. Recommend that MCPI check for nulls
explicitly in its FileObject[], and if it detects one, throw a more informative
exception, giving the impl class of the Result instance and showing the array
(Arrays.asList(sources).toString()).

I have examined both Result impls created in apisupport/project and I cannot see
any way they could possibly include null elements in the array, but I will put
in extra assertions just in case.
Comment 2 Adam Sotona 2005-05-03 11:16:35 UTC
I am working on projectization of Mobility and it happens every time I open any
Mobility project and is occassionally thrown till I close the last.
Everything seems to be working but the exceptions are annoying.
It looks like the apisupport project gives the null resources in classpath.
Comment 3 Adam Sotona 2005-05-03 11:19:04 UTC
Created attachment 21946 [details]
stack trace of the exception
Comment 4 Jesse Glick 2005-05-03 15:10:21 UTC
BTW I already have assertions in apisupport/project checking that it does not
pass null elements. So it is up to javacore to provide better error information.
Comment 5 Adam Sotona 2005-05-04 10:09:07 UTC
org.netbeans.modules.apisupport.project.SourceForBuiltModule expects openide.jar
in /nbbuild/netbeans/platform5/core/ ant it doesn't respect netbeans.dest.dir
property to be set differently (for us it is not "nbbuild" but just "build" folder).

Here is the piece of code (line 57-):
            // XXX temporary hack for openide split
            String suffix = "/nbbuild/netbeans/platform5/core/openide.jar"; //
NOI18N
            if (jarFileUS.endsWith(suffix)) {

so when openide.jar arrives it falls into a wrong code branch and results in
non-asserted null FileObject.

Here is the piece of code(line 117-):
                        return new SourceForBinaryQuery.Result() {
                            public FileObject[] getRoots() {
                                return new FileObject[] {
                                    FileUtil.toFileObject(new File(projectDir,
"src")), // NOI18N
                                };
                            }
Comment 6 Jesse Glick 2005-05-04 19:09:32 UTC
I will prevent it returning a null element in the result. (Find Usages did not
catch this anon inner class, sorry!) I will also fix it to actually return
openide/src from your NB src dir if you have netbeans.sources defined correctly.

Also putting diagnostics into MergedClassPathImplementation, since no one from
javacore bothered to do this.
Comment 7 Jesse Glick 2005-05-06 06:10:52 UTC
Fixed as part of a larger commit.
Comment 8 pzajac 2005-11-22 09:57:06 UTC
works for me