Dom API operation "children: collections" parent is null

Answered

We want to modify "children: collections". I first delete the original child tag in the write thread and then add a new tag, but an exception occurs in the subsequent reading

It will appear in a large number of writes

2021-11-15 10:31:16,788 [1626673] ERROR - llij.ide.plugins.PluginManager - Element: class com.intellij.psi.impl.source.xml.XmlTagImpl #XML because: parent is null
invalidated at: see attachment
com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.source.xml.XmlTagImpl #XML because: parent is null
invalidated at: see attachment
at com.intellij.psi.impl.source.tree.CompositePsiElement.getContainingFile(CompositePsiElement.java:106)
at com.intellij.util.xml.impl.DomImplUtil.getContainingFile(DomImplUtil.java:294)
at com.intellij.util.xml.impl.DomImplUtil.getFile(DomImplUtil.java:280)
at com.intellij.util.xml.impl.PhysicalDomParentStrategy.getContainingFile(PhysicalDomParentStrategy.java:84)
at com.intellij.util.xml.impl.DomInvocationHandler.getFile(DomInvocationHandler.java:529)
at com.intellij.util.xml.impl.CollectionChildDescriptionImpl.getCollectionSubTags(CollectionChildDescriptionImpl.java:39)
at com.intellij.util.xml.impl.DomInvocationHandler.getCollectionSubTags(DomInvocationHandler.java:848)
at com.intellij.util.xml.impl.DomInvocationHandler.getCollectionChildren(DomInvocationHandler.java:825)
at com.intellij.util.xml.impl.DomInvocationHandler.getCollectionChildren(DomInvocationHandler.java:792)
at com.intellij.util.xml.impl.GetCollectionChildInvocation.invoke(GetCollectionChildInvocation.java:30)
at com.intellij.util.xml.impl.DomInvocationHandler.invoke(DomInvocationHandler.java:657)
at com.hundsun.gaps.idea.domui.description.GapsComponentFileDescription$GapsInputExecute$$EnhancerByJetBrainsMainCglib$$2ea5b69b.getInputs(<generated>)
at com.hundsun.gaps.idea.flowcomponent.control.FlowComponentInputControl.modelToData(FlowComponentInputControl.java:64)
at com.hundsun.gaps.idea.flowcomponent.control.FlowComponentInputControl.setValueToUI(FlowComponentInputControl.java:52)
at com.hundsun.gaps.idea.domui.control.CompositeControl.setValue(CompositeControl.java:78)
at com.hundsun.gaps.idea.domui.control.CompositeControl.doReset(CompositeControl.java:91)
at com.intellij.util.xml.ui.BaseControl.reset(BaseControl.java:176)
at com.intellij.util.xml.ui.CompositeCommittable.reset(CompositeCommittable.java:45)
at com.hundsun.gaps.idea.domui.GapsDomFileEditor.reset(GapsDomFileEditor.java:158)
at com.intellij.util.xml.ui.UndoHelper$2.undoTransparentActionFinished(UndoHelper.java:53)
at com.intellij.util.xml.ui.UndoHelper$2.commandFinished(UndoHelper.java:59)
at sun.reflect.GeneratedMethodAccessor49.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.util.messages.impl.MessageBusImpl.invokeListener(MessageBusImpl.java:632)
at com.intellij.util.messages.impl.MessageBusImpl.executeOrAddToQueue(MessageBusImpl.java:245)
at com.intellij.util.messages.impl.CompositeMessageBus$ToDirectChildrenMessagePublisher.publish(CompositeMessageBus.java:135)
at com.intellij.util.messages.impl.MessageBusImpl$MessagePublisher.invoke(MessageBusImpl.java:183)
at com.sun.proxy.$Proxy66.commandFinished(Unknown Source)
at com.intellij.openapi.command.impl.CoreCommandProcessor.fireCommandFinished(CoreCommandProcessor.java:279)
at com.intellij.openapi.command.impl.CoreCommandProcessor.finishCommand(CoreCommandProcessor.java:260)
at com.intellij.openapi.command.impl.CommandProcessorImpl.finishCommand(CommandProcessorImpl.java:34)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:226)
at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:177)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:98)
at com.intellij.openapi.editor.actionSystem.EditorAction.actionPerformed(EditorAction.java:73)
at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:282)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher$1.performAction(IdeKeyEventDispatcher.java:610)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.lambda$processAction$3(IdeKeyEventDispatcher.java:670)
at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:669)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processAction(IdeKeyEventDispatcher.java:620)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.processActionOrWaitSecondStroke(IdeKeyEventDispatcher.java:517)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.inInitState(IdeKeyEventDispatcher.java:471)
at com.intellij.openapi.keymap.impl.IdeKeyEventDispatcher.dispatchKeyEvent(IdeKeyEventDispatcher.java:220)
at com.intellij.ide.IdeEventQueue.dispatchKeyEvent(IdeEventQueue.java:890)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:835)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:452)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:744)
at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$9(IdeEventQueue.java:451)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:802)

 

1 comment
Comment actions Permalink

Please try using com.intellij.util.xml.DomElement#createStableCopy for myDomElement so it survives manipulations.

0

Please sign in to leave a comment.