Not disposed pointer?

Hi,

I am writing a new module builder for my plugin. In my module builder's setupRootModel-method, I am creating some new folders under the module source root. In one of those folders I am also creating a single file from a template. This all works fine: when the module is created, I see it in the editor (along with the new file which also looks fine).

However, every time when I close IntelliJ after adding my module type, I get an error about a 'not disposed pointer'. The error message points directly to my newly created file.

Here is my code to create the new file:

        final FileTemplateManager manager = FileTemplateManager.getInstance();
        final FileTemplate template = manager.getJ2eeTemplate(templateName);
        final PsiElement file = FileTemplateUtil.createFromTemplate(template, fileName, new Properties(), directory);

(copied from the existing Android plugin source code.)

This code is executed inside a WriteCommandAction, which in turn is executed inside a DumbAwareRunnable.

The stacktrace I get when closing IntelliJ:

[  20522]  ERROR - ij.components.ComponentManager - Not disposed pointer: listener=null: URL=file://D:/Projects/IdeaPluginTest/untitled/src/main/resources/my.xml
com.intellij.openapi.vfs.impl.VirtualFilePointerImpl$MyException: Not disposed pointer: listener=null: URL=file://D:/Projects/IdeaPluginTest/untitled/src/main/resources/my.xml
    at com.intellij.openapi.vfs.impl.VirtualFilePointerImpl.throwNotDisposedError(VirtualFilePointerImpl.java:120)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.assertPointersDisposed(VirtualFilePointerManagerImpl.java:345)
    at com.intellij.openapi.vfs.impl.VirtualFilePointerManagerImpl.disposeComponent(VirtualFilePointerManagerImpl.java:336)
    at com.intellij.openapi.components.impl.ComponentManagerImpl.disposeComponents(ComponentManagerImpl.java:141)
    at com.intellij.openapi.application.impl.ApplicationImpl.dispose(ApplicationImpl.java:569)
    at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:46)
    at com.intellij.openapi.util.Disposer$1.execute(Disposer.java:44)
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:124)
    at com.intellij.openapi.util.objectTree.ObjectNode$1.execute(ObjectNode.java:106)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeActionWithRecursiveGuard(ObjectTree.java:151)
    at com.intellij.openapi.util.objectTree.ObjectNode.execute(ObjectNode.java:106)
    at com.intellij.openapi.util.objectTree.ObjectTree.executeAll(ObjectTree.java:133)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:104)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:100)
    at com.intellij.openapi.application.impl.ApplicationImpl.a(ApplicationImpl.java:329)
    at com.intellij.openapi.application.impl.ApplicationImpl.access$400(ApplicationImpl.java:85)
    at com.intellij.openapi.application.impl.ApplicationImpl$9.run(ApplicationImpl.java:776)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:790)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:748)
    at com.intellij.openapi.application.impl.ApplicationImpl.exit(ApplicationImpl.java:744)
    at com.intellij.openapi.wm.impl.IdeFrameImpl$2$1.run(IdeFrameImpl.java:181)
    at com.intellij.openapi.application.impl.LaterInvocator$FlushQueue.run(LaterInvocator.java:333)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
    at java.awt.EventQueue.access$000(EventQueue.java:84)
    at java.awt.EventQueue$1.run(EventQueue.java:602)
    at java.awt.EventQueue$1.run(EventQueue.java:600)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
    at com.intellij.ide.IdeEventQueue.e(IdeEventQueue.java:699)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:538)
    at com.intellij.ide.IdeEventQueue.b(IdeEventQueue.java:420)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:378)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[  20527]  ERROR - ij.components.ComponentManager - IntelliJ IDEA 11.1.1  Build #IU-117.117
[  20527]  ERROR - ij.components.ComponentManager - JDK: 1.6.0_29
[  20527]  ERROR - ij.components.ComponentManager - VM: Java HotSpot(TM) 64-Bit Server VM
[  20528]  ERROR - ij.components.ComponentManager - Vendor: Sun Microsystems Inc.
[  20528]  ERROR - ij.components.ComponentManager - OS: Windows 7
[  20528]  ERROR - ij.components.ComponentManager - Last Action: NewModuleInGroup


Apparently I have forgotten something?

Kind regards,
Martijn

1 comment
Comment actions Permalink

Okay, I have found the cause of this issue:
     The Spring plugin that is packaged with the 'Ultimate' version of IntelliJ.

I have just discovered that this issue *only* occurs when the file (that is created by my plugin) is an XML file... and it has a Spring-beans definition in it. Whenever my plugin creates this file, the 'Spring Framework is detected in the project' message appears (so far, I have always ignored this pop-up message during my plugin development). However, as a test, I once configured the Spring plugin for my new module and from then on: when I started/closed the project, the error message never re-appeared. As a final test I have let my plugin create *only* the required folder structure and then I manually created this Spring XML file. The result was as expected: the same error message!

So this looks to me like a bug in the Spring plugin.

Martijn

0

Please sign in to leave a comment.