Bug 203551 - IllegalStateException: The model is not initialized or is broken.
IllegalStateException: The model is not initialized or is broken.
Status: RESOLVED FIXED
Product: projects
Classification: Unclassified
Component: Maven
7.0
All All
: P2 (vote)
: 7.3
Assigned To: Milos Kleint
issues@projects
EXCEPTIONS_REPORT
: 7.2_WAIVER_APPROVED
: 184595 190040 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-10-11 20:54 UTC by sreder
Modified: 2012-08-31 02:01 UTC (History)
9 users (show)

See Also:
Issue Type: DEFECT
:


Attachments
stacktrace (2.34 KB, text/plain)
2011-10-11 20:54 UTC, sreder
Details
stacktrace (1.65 KB, text/plain)
2012-04-15 15:53 UTC, everflux
Details
stacktrace (1.65 KB, text/plain)
2012-05-31 11:08 UTC, J Bachorik
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sreder 2011-10-11 20:54:22 UTC
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

User Comments:
sreder: Just clean/building a maven project




Stacktrace: 
java.lang.IllegalStateException: The model is not initialized or is broken.
   at org.netbeans.modules.xml.xdm.XDMModel.checkStableOrParsingState(XDMModel.java:1001)
   at org.netbeans.modules.xml.xdm.XDMModel.getDocument(XDMModel.java:839)
   at org.netbeans.modules.xml.xdm.nodes.NodeImpl.getNamespaceURI(NodeImpl.java:604)
   at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.getQName(AbstractDocumentComponent.java:778)
   at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.getQName(AbstractDocumentComponent.java:774)
   at org.netbeans.modules.maven.model.pom.impl.POMComponentImpl.getChildElementText(POMComponentImpl.java:162)
Comment 1 sreder 2011-10-11 20:54:27 UTC
Created attachment 111890 [details]
stacktrace
Comment 2 Svata Dedic 2011-10-21 11:54:08 UTC
*** Bug 190040 has been marked as a duplicate of this bug. ***
Comment 3 Svata Dedic 2011-10-21 11:56:08 UTC
*** Bug 184595 has been marked as a duplicate of this bug. ***
Comment 4 everflux 2012-04-15 15:53:23 UTC
Created attachment 118286 [details]
stacktrace

having two maven pom.xml files open, selecting dependencies from one file, switching to other file with the intent to paste the conten.
Comment 5 J Bachorik 2012-05-31 11:08:46 UTC
Created attachment 120118 [details]
stacktrace

editing pom.xml
Comment 6 Exceptions Reporter 2012-05-31 11:09:04 UTC
This bug already has 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=181899
Comment 7 Svata Dedic 2012-06-04 14:54:29 UTC
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.
Comment 8 everflux 2012-06-04 19:07:04 UTC
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.
Comment 9 Svata Dedic 2012-06-05 12:30:09 UTC
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.
Comment 10 Milos Kleint 2012-06-19 11:27:07 UTC
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.
Comment 11 Milos Kleint 2012-08-30 08:13:38 UTC
https://hg.netbeans.org/core-main/rev/4cd0d9c0168e

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.
Comment 12 Quality Engineering 2012-08-31 02:01:47 UTC
Integrated into 'main-golden', will be available in build *201208310001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/4cd0d9c0168e
User: Milos Kleint <mkleint@netbeans.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


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo