This bug was originally marked as duplicate of bug 190041, that is already resolved. This bug is still valid, so this seems to be another bug, but it might be related.
Build: NetBeans IDE 7.0.1 (Build 201107282000)
VM: Java HotSpot(TM) Client VM, 20.2-b06, Java(TM) SE Runtime Environment, 1.6.0_27-b07
OS: Windows 7
sreder: Just clean/building a maven project
java.lang.IllegalStateException: The model is not initialized or is broken.
Created attachment 111890 [details]
*** Bug 190040 has been marked as a duplicate of this bug. ***
*** Bug 184595 has been marked as a duplicate of this bug. ***
Created attachment 118286 [details]
having two maven pom.xml files open, selecting dependencies from one file, switching to other file with the intent to paste the conten.
Created attachment 120118 [details]
This bug already has 20 duplicates
I still cannot reproduce the issue under debugger. Is the file broken (at the time when the error happens) ? Do you edit the file, or open it ?
It's timing - dependent anyway, I put some delay to the navigator and I am able to trigger the defect from time to time when working on not-wellformed file.
As far as I remember the bug appeared on opening a well formed POM (Maven) XML file. But it might be really the case that I opened it in order to fix the xml.
OK, after applying some logs:
1/ the file gets selected. At that time, the file is valid and the Maven model is created using MavenEmbedder.createModelLineage. This call SUCCEEDS, the file is OK at the moment
2a/ the Navigator attempts to resolve individual artifacts from the POM. It also refreshes the resolved POMs and creates POMModels
2b/ the editor content is changed in parallel to 2a
This may happen e.g. if the artifact resolution is slow, FU.refresh() is slow on a POM etc. The 'broken' navigator contents is only displayed when the createModelLineage fails, if POM becomes invalid after that, the navigator attempts to display POM children, which access the model, and fail on BROKEN model.
See for example report http://bugzilla-attachments-203551.netbeans.org/bugzilla/attachment.cgi?id=111890 - a tooltip is being displayed while the model is already broken. All such calls from navigator Node implementations must be somehow guarded and return some standard 'error' value, perhaps triggering POMModelPanel.showTask() to reconsider the navigator contents.
I also suggest to make one more check at the end of data preparation in POMModelPanel, and display Error node if the model becomes broken.
I'd like to waive this issue, the number of occurrences in exception reporter since 6.8 is not that high and threading and synchronization has always been a sinister problem when dealing with the pom's xam model.
fix attampts to approach the problem by creating a non-managed model that doesn't automatically synchronize with the document. Only updates as the file gets saved.
Integrated into 'main-golden', will be available in build *201208310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Milos Kleint <firstname.lastname@example.org>
Log: #203551 create a fresh, not managed model for the navigator view, The model is only updated when file gets saven now. adding asserts that should verify the assmption made about xam/xdm