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.
[Build 20050125] Steps: 1) create J2EE application with EJB and web module 2) add the project to CVS 3) go to project tab and clcik on project tab, invoke New | Session Bean Get NPE
Created attachment 19992 [details] stack trace
Java team asked for evaluation as behaviour is similar to 53265
*** This issue has been marked as a duplicate of 53265 ***
I was able to reproduce this issue in the latest daily build 20050130. There are steps that I followed: 1) start IDE with empty userdit 2) go to File -> New Project -> select Enterprise category -> select Enterprise application 3) click Next 4) specify project location, eg. /home/test/Project 5) click Next, the project is generated, the project includes one web and ejb module by default 6) go to Versioning -> Versioning manager and add versioned directory eg. /home/test/Project 7) initial checkout from CVS 8) go to project tab and select node representing J2EE application and Add to repository 9) gto project tab and select EJB module node 10) right-click and select New - Session bean 11) specify package name and click Finish and get Exception
Problem is probably caused by cvs integration. FileUtil.isParentOf(root, file) returns false for root = /tmp/J2eeApplication1111/J2eeApplication1111-ejb/src/java/ file = /tmp/J2eeApplication1111/J2eeApplication1111-ejb/src/java/test/ reassigning to vcscvs for further evaluation.
Impl. of FileUtil.isParentOf() seems to be pretty clear. The only suspicious thing seems to be: if (folder.getFileSystem () != fo.getFileSystem ()) { return false; } But everything should come from the MasterFS anyway. What are the instances of FileObjects that you give as arguments to isParentOf() and what is the working directory of the CVS?
The reproduction of this depends on issue #54421.
Well, I get a lot of calls like: isParentOf(MasterFileObject@124f39a[file:/D:/NETBEANS/SRC/nb_all/xtest/src/], AbstractFileObject@a4480d[jar:file:/D:/NETBEANS/SRC/nb_all/xtest/lib/nbj unit-ide.jar!/]) FS1 = org.netbeans.modules.masterfs.MasterFileSystem[org.netbeans.modules.masterfs.MasterFileSystem@e5f3d2], FS2 = D:\NETBEANS\SRC\nb_all\xtest\lib\nbjunit-ide.jar[org.openide.filesystems.JarFileSystem@1766d9c] java.lang.Exception: Stack trace at java.lang.Thread.dumpStack(Thread.java:1155) at org.openide.filesystems.FileUtil.isParentOf(FileUtil.java:850) at org.netbeans.modules.java.freeform.SourceLevelQueryImpl.getSourceLevel(SourceLevelQueryImpl.java:75) at org.netbeans.modules.java.project.ProjectSourceLevelQueryImpl.getSourceLevel(ProjectSourceLevelQueryImpl.java:37) at org.netbeans.api.java.queries.SourceLevelQuery.getSourceLevel(SourceLevelQuery.java:46) at org.netbeans.modules.javacore.JMManager.getSourceLevel(JMManager.java:1057) at org.netbeans.modules.javacore.JMManager.getRootURI(JMManager.java:1063) at org.netbeans.modules.javacore.JMManager.cleanUpCodebases(JMManager.java:797) at org.netbeans.modules.javacore.JMManager.access$500(JMManager.java:61) at org.netbeans.modules.javacore.JMManager$4.run(JMManager.java:1156) at org.openide.util.Task.run(Task.java:189) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:330) at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:721) Tomas, is this O.K. ??? It looks very strange. Someone is trying to compare a folder with a file inside a Jar. A lot of calls like this happens before I got issue #54421. Perhaps it's somehow related??
I've went through the steps without problems. No NPE encountered, no calls of FileUtil.isParentOf() accross filesystems. Please specify better steps how to reproduce...
Martin, I don't know. I have no knowledge about implementation of getSourceLevel query. I think that this not related. BTW: I was able to reproduce it without any problems.
I've finally reproduced the exception. It's necessary to specify a package name that consists of several "folders". Like "p1.p2.p3". Not just "p1". However it did not help me to find the cause of the bug. I've verified that the exception occurs only when a VCS filesystem is mounted (it's not necessary to actually run any VCS commands). But it does not seem to have anything with isParentOf(). I'm going to attach a log that I've generated with all calls to isParentOf() which return false. There does not seem to be anything wrong...
Created attachment 20242 [details] The log with calls to isParentOf().
Moving to j2ee component, please be more specific about what does VCS wrong. Thanks.
I checked this code in FileUtil.isParentOf: if (folder.getFileSystem () != fo.getFileSystem ()) { return false; } This issue occurs only if this condition returns false. Check following example: AbstractFileObject@1d5f0e6[file:/local/martin/tmp/cvs_pblaha/madamek/qqq3/src/java/] MasterFileObject@164f383[file:/local/martin/tmp/cvs_pblaha/madamek/qqq3/src/java/qqq/NewSessionLocalBusiness.java] Names are OK, but FileSystems are: CommandLineVcsFileSystem vs. MasterFileSystem Reassigning to vcscore
Apparently you get access to our FileObject. This should not happen. Other modules should not know about FileObjects from VCS filesystems. Just FileObjects from MasterFileSystem should be used. I will probably need some help from J2EE developers to find the place where our FileObjects are exposed...
It's strange that I did not encounter this kind of call (viz my attachment). I'll play with that again...
I found that if I modify mentioned condition like this: if (folder.getFileSystem () != fo.getFileSystem ()) { String parentName = folder.getPath(); String childName = fo.getPath(); FileSystem parentFS = folder.getFileSystem(); FileSystem childFS = fo.getFileSystem(); assert (childName.indexOf(parentName) == 0 && !parentFS.equals(childFS)) : "### " + folder + ", " + fo; return false; } I am not able to reproduce issue. This condition will return false only once - somewhere in Add or Commit process. Here is output of assert: java.lang.AssertionError: ### AbstractFileObject@ee765[file:/local/martin/tmp/cvs_pblaha/madamek/111/], MasterFileObject@79ca2e[file:/local/martin/tmp/cvs_pblaha/madamek/111/src/] at org.openide.filesystems.FileUtil.isParentOf(Unknown Source) at org.openide.filesystems.FileUtil.getRelativePath(Unknown Source) at org.netbeans.spi.project.support.ant.SourcesHelper.remarkExternalRoots(SourcesHelper.java:278) at org.netbeans.spi.project.support.ant.SourcesHelper.registerExternalRoots(SourcesHelper.java:242) at org.netbeans.modules.j2ee.ejbjarproject.EjbJarProject$2.run(EjbJarProject.java:241) at org.openide.util.Mutex.leave(Unknown Source) at org.openide.util.Mutex.readAccess(Unknown Source) at org.netbeans.api.project.ProjectManager.findProject(ProjectManager.java:175) at org.netbeans.modules.projectapi.SimpleFileOwnerQueryImplementation.getOwner(SimpleFileOwnerQueryImplementation.java:63) at org.netbeans.api.project.FileOwnerQuery.getOwner(FileOwnerQuery.java:68) at org.netbeans.modules.j2ee.deployment.config.ConfigDataLoader.findPrimaryFile(ConfigDataLoader.java:146) at org.openide.loaders.MultiFileLoader.findPrimaryFileImpl(MultiFileLoader.java:232) at org.openide.loaders.MultiFileLoader.handleFindDataObject(MultiFileLoader.java:65) at org.openide.loaders.DataObjectPool.handleFindDataObject(DataObjectPool.java:111) at org.openide.loaders.DataLoader.findDataObject(DataLoader.java:358) at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:386) at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:346) at org.openide.loaders.DataObject.find(DataObject.java:459) at org.netbeans.modules.vcscore.objectintegrity.VcsObjectIntegritySupport.run(VcsObjectIntegritySupport.java:308) at org.openide.util.Task.run(Unknown Source) [catch] at org.openide.util.RequestProcessor$Task.run(Unknown Source) at org.openide.util.RequestProcessor$Processor.run(Unknown Source) Hope this can help
Thanks for that info! That helps a lot. It seems like the responsible is VcsObjectIntegritySupport. It creates DataObjects on VCS FS.
It's assured that DataObject.find() is not called on FileObjects that come from VCS filesystem. This seems to fix this. I did not encounter any NPE after this change, please verify. /cvs/vcscore/src/org/netbeans/modules/vcscore/VcsAttributes.java,v <-- VcsAttributes.java new revision: 1.42; previous revision: 1.41 /cvs/vcscore/src/org/netbeans/modules/vcscore/VcsFileSystem.java,v <-- VcsFileSystem.java new revision: 1.316; previous revision: 1.315 /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/CommandCustomizationSupport.java,v <-- CommandCustomizationSupport.java new revision: 1.45; previous revision: 1.44 /cvs/vcscore/src/org/netbeans/modules/vcscore/commands/CommandExecutorSupport.java,v <-- CommandExecutorSupport.java new revision: 1.74; previous revision: 1.73 /cvs/vcscore/src/org/netbeans/modules/vcscore/grouping/MainVcsGroupChildren.java,v <-- MainVcsGroupChildren.java new revision: 1.10; previous revision: 1.9 /cvs/vcscore/src/org/netbeans/modules/vcscore/objectintegrity/VcsObjectIntegritySupport.java,v <-- VcsObjectIntegritySupport.java new revision: 1.25; previous revision: 1.24 /cvs/vcscore/src/org/netbeans/modules/vcscore/util/VcsUtilities.java,v <-- VcsUtilities.java new revision: 1.47; previous revision: 1.46 /cvs/vcscore/src/org/netbeans/modules/vcscore/versioning/impl/FileSystemNode.java,v <-- FileSystemNode.java new revision: 1.8; previous revision: 1.7 /cvs/vcscore/src/org/netbeans/modules/vcscore/versioning/impl/FolderNode.java,v <-- FolderNode.java new revision: 1.15; previous revision: 1.14
Works for me, thanks!
[Build 20050214]