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.
Build: NetBeans IDE 6.7 Beta (Build 200904242137) VM: Java HotSpot(TM) Client VM, 10.0-b22, Java(TM) SE Runtime Environment, 1.6.0_06-b02 OS: Windows Vista, 6.0, x86 User Comments: GUEST: I wanted to change the Source/Binary-Format from 1.3 to 1.6 in the properties of a Maven jar project, when the crash occured. Stacktrace: java.lang.IllegalArgumentException: old node must be in the tree at org.netbeans.modules.xml.xdm.XDMModel.getPathToRoot(XDMModel.java:320) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:360) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:339) at org.netbeans.modules.xml.xdm.XDMModel.append(XDMModel.java:622) at org.netbeans.modules.xml.xdm.xam.XDMAccess.appendChild(XDMAccess.java:267) at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.appendChildQuietly(AbstractDocumentComponent.java:296)
Created attachment 82367 [details] stacktrace
Build: NetBeans IDE 6.7 RC2 (Build 200906042131) VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03 OS: Windows Vista, 6.0, amd64 User Comments: I tried to deploy a maven web project to Glassfish V3 server Stacktrace: java.lang.IllegalArgumentException: old node must be in the tree at org.netbeans.modules.xml.xdm.XDMModel.getPathToRoot(XDMModel.java:320) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:360) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:339) at org.netbeans.modules.xml.xdm.XDMModel.append(XDMModel.java:622) at org.netbeans.modules.xml.xdm.xam.XDMAccess.appendChild(XDMAccess.java:267) at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.appendChildQuietly(AbstractDocumentComponent.java:296)
Created attachment 83466 [details] stacktrace
This issue already has 12 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=150616
Build: NetBeans IDE 6.7 RC2 (Build 200906042131) VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03 OS: Windows Vista, 6.0, amd64 User Comments: Set Glassfish V3 as the server in a maven web project properties Stacktrace: java.lang.IllegalArgumentException: old node must be in the tree at org.netbeans.modules.xml.xdm.XDMModel.getPathToRoot(XDMModel.java:320) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:360) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:339) at org.netbeans.modules.xml.xdm.XDMModel.append(XDMModel.java:622) at org.netbeans.modules.xml.xdm.xam.XDMAccess.appendChild(XDMAccess.java:267) at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.appendChildQuietly(AbstractDocumentComponent.java:296)
Created attachment 83467 [details] stacktrace
This issue already has 13 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=150616
Build: NetBeans IDE 6.7 (Build 200906241340) VM: Java HotSpot(TM) 64-Bit Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03 OS: Windows Vista, 6.0, amd64 User Comments: Stacktrace: java.lang.IllegalArgumentException: old node must be in the tree at org.netbeans.modules.xml.xdm.XDMModel.getPathToRoot(XDMModel.java:320) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:360) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:339) at org.netbeans.modules.xml.xdm.XDMModel.append(XDMModel.java:622) at org.netbeans.modules.xml.xdm.xam.XDMAccess.appendChild(XDMAccess.java:267) at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.appendChildQuietly(AbstractDocumentComponent.java:296)
Created attachment 84363 [details] stacktrace
This issue already has 14 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=150616
Build: NetBeans IDE Dev (Build 090821) VM: Java HotSpot(TM) Client VM, 1.5.0_09-b03, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_09-b03 OS: Linux, 2.6.29.6-desktop-2mnb, i386 User Comments: Stacktrace: java.lang.IllegalArgumentException: old node must be in the tree at org.netbeans.modules.xml.xdm.XDMModel.getPathToRoot(XDMModel.java:320) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:360) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:339) at org.netbeans.modules.xml.xdm.XDMModel.append(XDMModel.java:622) at org.netbeans.modules.xml.xdm.xam.XDMAccess.appendChild(XDMAccess.java:267) at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.appendChildQuietly(AbstractDocumentComponent.java:296)
Created attachment 86621 [details] stacktrace
I can reliably reproduce by doing the following 1. create a maven project 2. go to project properties, change source level and encoding 3. CANCEL the dialog (the transaction shall be rollbacked) 4. go to project properties again, fiddle with source level and encoding -> exception
Build: NetBeans IDE Dev (Build 090821) VM: Java HotSpot(TM) Client VM, 1.5.0_09-b03, Java(TM) 2 Runtime Environment, Standard Edition, 1.5.0_09-b03 OS: Linux, 2.6.29.6-desktop-2mnb, i386 User Comments: cancel on maven project proeprties dialog, then open it again immediately Stacktrace: java.lang.IllegalArgumentException: old node must be in the tree at org.netbeans.modules.xml.xdm.XDMModel.getPathToRoot(XDMModel.java:320) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:360) at org.netbeans.modules.xml.xdm.XDMModel.mutate(XDMModel.java:339) at org.netbeans.modules.xml.xdm.XDMModel.append(XDMModel.java:622) at org.netbeans.modules.xml.xdm.xam.XDMAccess.appendChild(XDMAccess.java:267) at org.netbeans.modules.xml.xam.dom.AbstractDocumentComponent.appendChildQuietly(AbstractDocumentComponent.java:296)
Created attachment 86679 [details] stacktrace
Steps to reproduce: 1. Create a simple Maven project 2. Invoke the dialog Project Properties. 3. In the tree Categories select the tree node Sources. 4. Select a new value in the combo-box Source/Binary Format (for example, change the value 1.3 to 1.5). 5. Click the button Cancel. 6. Repeat steps 2, 3, 4. Result: IllegalArgumentException will be thrown. If the button OK is used in the step 5 instead of the button Cancel, this bug will never happen. This bug is caused by mismatch of POMModel based on XAM and a related XDM model, which updates pom.xml. When user changes a value in the combo-box Source/Binary Format for the first time, a chain of method invocations will contain: SourcesPanel.handleSourceLevelChange() { .............. ModelUtils.checkSourceLevel(handle, sourceLevel); .............. } ModelUtils.checkSourceLevel(...) { POMModel mdl = ...; .............. mdl.getProject().setBuild(mdl.getFactory().createBuild()); .............. mdl.getProject().getBuild().addPlugin(plugin); } So, now POMModel tree will be modified: Project -> Build -> PluginList (Plugins) -> Plugin. But XDM model and pom.xml are not modified because a started transaction is not finished yet. This transaction will be either commited (an user clicks OK) or rolled back (an user clicks Cancel): // OK CustomizerProviderImpl.OptionListener.actionPerformed(...) { .............. if (handle.isModified(handle.getPOMModel())) { handle.getPOMModel().endTransaction(); } else { handle.getPOMModel().rollbackTransaction(); } .............. } A structure of pom.xml will be modified: <project> <build> <plugins> <plugin> // Cancel CustomizerProviderImpl.OptionListener.windowClosed(...) { .............. if (handle.getPOMModel().isIntransaction()) { handle.getPOMModel().rollbackTransaction(); } .............. } A structure of pom.xml will not be modified in this case, but (!) POMModel will still contain an object Build (model's changes will not be rolled back). And when user tries to change value of Source/Binary Format for the 2nd time (after clicking Cancel), this will throw an exception because value of variable 'childs' (see below) is not null (POMModel (XAM) contains an object Build): BuildBaseImpl.addPlugin(Plugin plugin) { ModelList<Plugin> childs = getChild(PluginImpl.List.class); if (childs == null) { .............. } childs.addListChild(plugin); } Then childs.addListChild(plugin) invokes XDMModel.getPathToRoot((Node node, Document root) and PathFromRootVisitor.findPath(Document root, Node target) XDM model (pom.xml) was not modified and doesn't contain a required node <build>. So, a required path can't be defined ==> IllegalArgumentException. More investigation of XAM and XDM interaction is needed.
This issue already has 22 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=150616
This issue already has 23 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=150616
This issue already has 24 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=150616
Now I'd like to describe a result of my investigation related to my comment dated by Mon Oct 5 19:43:40 Please look at additional comments from alexpetrov Mon Oct 5 19:43:40 +0000 2009. Short description. IllegalArgumentException will be thrown if an user clicks Cancel button while editing of maven project properties, because XAM and XDM models will get unsynchronized, though if OK is clicked XAM and XDM models will be synchronized. It seems that this behaviour is caused by the following reason: If an user clicks Cancel button the method rollbackTransaction() will be invoked: org.netbeans.modules.maven.customizer.CustomizerProviderImpl.java CustomizerProviderImpl.OptionListener.windowClosed(...) => handle.getPOMModel().rollbackTransaction() => org.netbeans.modules.xml.xam.AbstractModel.rollbackTransaction() Invocation of rollbackTransaction() should remove a created object Build (org.netbeans.modules.maven.model.pom.Build) from POMModel (XAM model). Here is a chain of method invocations: AbstractModel.rollbackTransaction() => AbstractModel$ModelUndoableEditSupport.abortUpdate() => ... => XDMAccess.finishUndoRedo() => XDMListener.endSync() => ... => AbstractDocumentModel.processSyncUnit() => AbstractDocumentModel.removeChildComponent(Component child) [child: org.netbeans.modules.maven.model.pom.impl.BuildImpl] => org.netbeans.modules.maven.model.pom.visitor.ChildComponentUpdateVisitor.update() [target: ProjectImpl, child: BuildImpl, operation: REMOVE] => BuildImpl.accept((POMComponentVisitor visitor) [visitor: ChildComponentUpdateVisitor] => org.netbeans.modules.maven.model.pom.visitor.DefaultVisitor.visit(Build target) => DefaultVisitor.visitComponent(...) But an implementation of DefaultVisitor.visitComponent() is empty: protected void visitComponent(POMComponent target) { } Thus an object Build has not been removed from POM model and this will cause an exception when project properties are edited in the next time. A correct implementation of the method visit(Build target) should be produced. So, I think this bug should be reassigned to maven plugin team. Please let me know if you have any objections.
alexpetrov: great thanks for the explanation. It seems I never really understood what the childupdatevisitor is supposed to do. I there any relevant example I could use to rewrite it?
OK, please, take a look at a piece of code below (it's a fragment of the class org.netbeans.modules.bpel.model.ext.editor.impl.NMPropertyImpl, which implements the method "... void update(...)"): public void update(BpelEntity target, ExtensionEntity child, int index, Operation operation) { if (target instanceof NMProperties) { NMProperties nmProperties = (NMProperties) target; NMProperty nmProperty = (NMProperty) child; switch (operation) { case ADD: nmProperties.insertNMProperty(nmProperty, index); break; case REMOVE: nmProperties.remove(nmProperty); break; } } } And then take a look at a COMMENTED PART OF CODE included into your class org.netbeans.modules.maven.model.pom.visitor.ChildComponentUpdateVisitor - I think it already contains code which you can use or which will be useful for you (I'm sure you will understand an idea very quickly). In your case: BpelEntity target => POMComponent target (ProjectImpl) ExtensionEntity child => POMComponent child (BuildImpl) So, your ProjectImpl just must remove an unnecessary BuildImpl from its model tree. Let me know if you have any questions.
alexpetrov: as I mentioned in a private email, I'm lost why the ComponentUpdater is necessary at all. The AbstractComponent class seems to have 2 generic methods for adding and removing child nodes. I've added a dummy implementation that to the ComponentUpdater that delegates to these methods and it seems to work. At least this exception is gone. The remaining question is what property is to be fired. It seems that none of the internals of the XAM/XDM models listen to it. No code in maven support listens to it either, so is it reasonable to assume that the property listening and firing is just an optional mechanism? Please review: http://hg.netbeans.org/core-main/rev/d9961884787f
Integrated into 'main-golden', will be available in build *200910300201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/d9961884787f User: Milos Kleint <mkleint@netbeans.org> Log: #165465 implement ComponentUpdater to really add/remove child components. Still not clear if the impl is correct or how to figure the right "property" to get fired.
Integrated into 'main-golden', will be available in build *200911041401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/4a49732ebdc9 User: Milos Kleint <mkleint@netbeans.org> Log: #165465 ContentUpdater for profiles and settings as well