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 the 200708080000 build.
Created attachment 46396 [details] Log
I was not able to simulate the failure on Windows XP Professional running on Intel(R) Xeon(R) CPU at 1.9 Ghz. I was able to simulate roughly 50% time after commenting the 1 second sleep at line 261. My guess is it is related to the slower system and/or load on the system. If it happens frequently on the test machine we can try by increasing the sleep time to 2 seconds at line 261.
Any sleep() calls in tests are likely to make the tests brittle. Please reconsider the need for the sleep() calls (and the need to do work in a RP thread in SourcePathImplementation, which I guess is why sleep() is needed). If you are sure you need the RP, consider adding a listener to "cp" and waiting for an entries event to be fired before asserting that "cp" contains the URLs.
I agree removing RP thread will eliminate the need to have Sleep in test code. But I think it is better existing code not to block other FileChangeListeners' till our task is finished. Blocking might create performance issues especially file node refreshing on slower machine. I have attached the patch, which uses listener on "cp" .
Created attachment 46470 [details] Patch for SourcePathImplAddonsTest
In the spirit on Donald Knuth's "premature optimization is the root of all evil" I'd like to ask if you have any numbers to support the performance issues. A few comments on the patch: - setGotCPChangeEvent() and getGotCPChangeEvent() belong in SourceClassPathListener. - moreover, you can get rid of them and the waiting code in createAndWaitForEvent() by using CountDownLatch. You create a CDL initialized to 1, call await() on in instead of the waiting code and countDown() instead of setGotCPChangeEvent().
Created attachment 50380 [details] Log of fails of testAddonsCreateSourceRoot and testAddonsRemoveSourceRoot
Attached patch uses Java 5 CDL, instead custom code.
Created attachment 50452 [details] SourcePathImplAddonsTestCDL.diff
Any progress here? Thanks.
Earlier thinking was I will check-in the 'SourcePathImplAddonsTestCDL.diff' changes if it was Ok with module owners. Will have to verify again the changes in the light of FileObject related changes as discussed in the below thread. http://www.netbeans.org/servlets/BrowseList?list=nbdev&by=thread&from=827178
Since the test is stable and pass looks like it was fixed.