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 59446 - NPE while opening external module
Summary: NPE while opening external module
Status: RESOLVED 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-05-31 17:58 UTC by Michal Zlamal
Modified: 2005-09-05 09:51 UTC (History)
1 user (show)

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 Michal Zlamal 2005-05-31 17:58:29 UTC
I got this NPE while I was opening external module and NB sources were defined 
via symlink.
The line "^Project is: " is output from command:
System.out.println("Project is: " + project.toString());
entered to line 266 in org.netbeans.modules.apisupport.project.
ClassPathProviderImpl

The problems are causing lines:
    static File findNetBeansOrg(File basedir) {
        File f = basedir;
        for (int i = 0; i < DEPTH_NB_ALL; i++) {
            f = f.getParentFile();
            if (isNetBeansOrg(f)) {
                return f;
            }
        }
        // Not here.
        return null;
    }
from org.netbeans.modules.apisupport.project.ModuleList, because it maches the 
same locations refered by different Strings - probably use of getCanonicalPath 
somewhere did the job :-(.

BTW: It was working for me for one project but for the other one it failed... 
From command line all is OK and working.

Debug output:
Project is: NbModuleProject[MasterFileObject@1bcfced[file:/builds/cvs/s1sme/
projecttest/f4j_me/kjava/j2meplatform/]]
*********** Exception occurred ************ at 6:49 PM on May 31, 2005
java.lang.NullPointerException
        at org.openide.filesystems.FileUtil.normalizeFileOnUnixAlike(FileUtil.
java:1108)
        at org.openide.filesystems.FileUtil.normalizeFile(FileUtil.java:1100)
        at org.netbeans.modules.apisupport.project.Util.urlForJar(Util.java:179)
        at org.netbeans.modules.apisupport.project.ClassPathProviderImpl.
createFuncTestCompileClasspath(ClassPathProviderImpl.java:267)
        at org.netbeans.modules.apisupport.project.ClassPathProviderImpl.
findClassPath(ClassPathProviderImpl.java:136)
        at org.netbeans.modules.apisupport.project.ClassPathProviderImpl.
getProjectClassPaths(ClassPathProviderImpl.java:357)
        at org.netbeans.modules.apisupport.project.NbModuleProject$OpenedHook.
projectOpened(NbModuleProject.java:782)
        at org.netbeans.spi.project.ui.ProjectOpenedHook$1.
projectOpened(ProjectOpenedHook.java:50)
[catch] at org.netbeans.modules.project.ui.OpenProjectList.
notifyOpened(OpenProjectList.java:413)
        at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.
java:171)
        at org.netbeans.modules.project.ui.actions.OpenProject.
actionPerformed(OpenProject.java:86)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:
1849)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.
java:2169)
        at javax.swing.DefaultButtonModel.
fireActionPerformed(DefaultButtonModel.java:420)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:
258)
        at javax.swing.plaf.basic.BasicButtonListener.
mouseReleased(BasicButtonListener.java:234)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:
231)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:
231)
        at java.awt.Component.processMouseEvent(Component.java:5488)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3093)
        at java.awt.Component.processEvent(Component.java:5253)
        at java.awt.Container.processEvent(Container.java:1966)
        at java.awt.Component.dispatchEventImpl(Component.java:3955)
        at java.awt.Container.dispatchEventImpl(Container.java:2024)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:
4212)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
        at java.awt.Container.dispatchEventImpl(Container.java:2010)
        at java.awt.Window.dispatchEventImpl(Window.java:1774)
        at java.awt.Component.dispatchEvent(Component.java:3803)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
        at java.awt.EventDispatchThread.
pumpOneEventForHierarchy(EventDispatchThread.java:242)
        at java.awt.EventDispatchThread.
pumpEventsForHierarchy(EventDispatchThread.java:163)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Comment 1 Jesse Glick 2005-05-31 18:06:38 UTC
I have no idea what you're talking about re. symlinks, getCanonicalPath, etc. -
if you can reproduce let me know. Anyway I already knew there is a bug in CPPI
which I have a fix for on disk (did not get to commit it yet).
Comment 2 Jesse Glick 2005-05-31 18:09:04 UTC
I should clarify: CPPI bug causes an NPE in case your external module has no
working source association that would let nb_all be found.
Comment 3 Jesse Glick 2005-05-31 23:14:29 UTC
Probably only affected modules with functional tests and no working nb_all
source association. Please verify.

committed     Up-To-Date  1.48       
apisupport/project/src/org/netbeans/modules/apisupport/project/ClassPathProviderImpl.java
Comment 4 Michal Zlamal 2005-06-01 08:30:53 UTC
IMHO this fix is only workaround to not put the test jars to classpath, but when 
external module has functional tests then it can't run them from IDE.
However the cause of this exception wasn't that there are not associated 
sources, it was that the sources where associated via symlink, thus the 
netbeans.dest.dir is not being recognized, because on one place it is with 
resolved symlink and on other without it (/builds/cvs/nbtrunk/nbbuild/netbeans !
= /builds/cvs/s1sme/testproject/nb_all/nbbuild/netbeans and the /builds/cvs/
s1sme/testproject/nb_all is a symlink to /builds/cvs/nbtrunk).
Please fix the cause not the exception printing!
BTW lowering prioty because it at least doesn't prevent IDE to open the project
Comment 5 Jesse Glick 2005-06-01 17:12:40 UTC
I just tried opening the suite Michal sent me in yesterday's dev build (w/ the
fix to CPPI, but shouldn't matter) and it worked fine, incl. source associations
on files. I did have to correct build/nbproject: it included suite.properties
(which makes no sense - suite projects do not have such a file, it is ignored),
and had

modules=${basedir}/../kjava/j2meplatform:${basedir}/../kjava/ant-ext:${basedir}/../kjava/j2meproject

which is certainly incorrect (basedir depends on the project loading the file).
I just fixed build/nbproject/project.properties to read

modules=${suite.dir}/../kjava/j2meplatform:${suite.dir}/../kjava/ant-ext:${suite.dir}/../kjava/j2meproject
suite.dir=${basedir}

and it opens fine.

The functional tests seem to have a mostly empty classpath, which I can look at.
Comment 6 Jesse Glick 2005-06-01 17:32:08 UTC
BTW I did find a problem in qa-functional classpath, but it pertains to usage of
an anonymous platform generally, not to use of symlinks. Leaving this bug as it
was - an NPE, which was already fixed.