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.
java.lang.IllegalStateException: Current thread has already started a transaction at o.n.modules.xml.xam.AbstractModel.startTransaction (AbstractModel.java:346) at o.n.modules.xml.xam.AbstractModel.sync (AbstractModel.java:257) at o.n.modules.maven.customizer.CustomizerProviderImpl.showCustomizer (CustomizerProviderImpl.java:146) ... Always reproducible with the latest builds (e.g. Build 100216-852030c3a90b) when I open a project's pom.xml in editor, close this editor and try opening the project's Properties from popup menu.
This bug was revealed by the fix of issue #166414. Now that the ModelSource's lookup always refers to the latest document opened for the POM, the code in CustomizerProviderImpl.showCustomizer() tries to sync the model and a Transaction is started for the sync(), but a Transaction has already been started in CustomizerProviderImpl.init() by creating ModelHandle instance which has the startTransaction() in its constructor. I see two possible fixes. Moving the sync() calls for POM model and Profiles model from CustomizerProviderImpl.showCustomizer() to ModelHandle's constructor before startTransaction() is called for the models there, or refactoring startTransaction() calls from ModelHandle's constructor to a public method and calling it from CustomizerProviderImpl.showCustomizer() after the sync() is called for the models.
the startTransaction() calls shall be deleted from the modelhandle and only started in the customizer after sync() I guess. The problem starts with the ModelHandleUtils class that returns a ModelHandle (in public/friend api signature). I suppose in this place we need to sync/startTransation before returning the handle for backward compatibility sake. We should definitely deprecate the ModelHandleUtils class. There is a possible loophole in the ModelHandle concept. No obvious way to explicitly rollback the transactions started. The ModelHandleUtils.write() method commits the transaction, so there could be a similar ModelHandleUtils.rollback() method, or at least explicitly document that a transaction has been started and needs to be commited./rollbacked.
http://hg.netbeans.org/core-main/rev/13ae5b397c61
*** Bug 180044 has been marked as a duplicate of this bug. ***
v.