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.
In Forte EE, I've got a module that extracts a jar file with class files and mounts it, then proceeds to do more activity that assumes that all the classes in the mounted directory structure are available through ClassElement. However, sometimes a long delay is necessary before the ClassElement call returns productively. I'll attach sample code that demonstrates the bug.
Created attachment 6476 [details] Java file to replicate the bug.
Created attachment 6477 [details] jar file that serves as input to the program.
Cannot reproduce in trunk builds (Solaris 5.8). All classes were found on the first try. Strange enough, I cannot reproduce it even with 3.3.2 NetBeans build. Note: I uncommented the line with "mountFolder(target);" in the testcase.
OK, I can see that it works the first time through. Second time, delete the com/ directory, comment out the mountFolder and re-run. (You can also see this by running importear on petstore.ear in FFJ4.0
You are extracting files onto filesystem (1), and trying to observe them on filesystem (2) [that is what is happending when you use ClassElement.forName -- it searches mounted filesystems for matching package/classname]. For fs(2), changes made through fs(1) appear just like they were made outside the IDE, or using java.io.File APIs - so the fs(2) contents are refreshed periodically and files appear only after the refresh. I can see some solutions: either extract the files right onto the mounted filesystem, or explicitly refresh all folders on fs (2) after extraction to ensure that fs(2) notices what had happened "on fs(1)". Or you can use some delegating filesystem implementation, like treefs as fs(2) implementation instead of plain LFS, so it will refire events from fs(1) and will maintain consistency. See treefs module in NB's CVS for more details.
The workaround to mount before extracting is good enough, thanks.
Reorganization of java component