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.
The following code in ProjectManager.java: if (Thread.currentThread() == loadingThread) { throw new IllegalStateException("Attempt to call ProjectManager.findProject within the body of ProjectFactory.loadProject (hint: try using ProjectManager.mutex().postWriteRequest(...) within the body of your Project's constructor to prevent this)"); // NOI18N } was apparently not triggered in issue #60011 as it should have been. Why not?
I have added a few debug messages into ProjectManager and reproduced issue #60011. The debug messages printed after I choosed "Finish" in the new project dialog are attached. The reason why the check was not succesfull is that: 1. findProject(".../testcvs/working/test12/") is called, sets loadingThread 2. findProject(".../testcvs/working/test12/test/unit/") is called, sets loadingThread, and then cleared (the loading of project is finished, obviously no project found). 3. same as 2 for ".../testcvs/working/test12/test/". 4. another call for findProject(".../testcvs/working/test12/"), but loadingThread is cleared by the previous findProject(s).
Created attachment 22718 [details] Debug logs.
Got it (thanks Jan). The check for reentrancy should be done right away, not conditionally.
committed Up-To-Date 1.15 projects/projectapi/src/org/netbeans/api/project/ProjectManager.java
Roll backed and reopened as proposed in issue #60371 - the patch caused lots of IllegalStateExceptions in webapps project.
No user-visible problem represented by this bug as far as I know; more of a check on incorrectly written project types.
Setting target milestone to "future". Please change the TM if you disagree.
most probably fixed. The code in ProjectManager is now changed. There is a loadingThread ThreadLocal variable that contains a Set of FileObjects that are being queried from the current thread. That should cover the described scenario.