Write access is allowed inside write-action only

Ihave written the archiving plugin (Jar Tool) and with the idea version 5.0 it gives this error message. any idea why and how can I get rid of it. the plugin works fine even though the error apears. but it does not refresh the project tree og the GUI


Assertion failed: Write access is allowed inside write-action only (see com.intellij.openapi.application.Application.runWriteAction())
java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:129)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:92)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByIoFile(LocalFileSystemImpl.java:85)
at it.codegen.jartool.client.actions.CreateJarAction.actionPerformed(CreateJarAction.java:92)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:23)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:15)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:54)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:1)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:112)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:129)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:92)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:154)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByIoFile(LocalFileSystemImpl.java:85)
at it.codegen.jartool.client.actions.CreateJarAction.actionPerformed(CreateJarAction.java:92)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:23)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:15)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:54)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:1)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:112)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:129)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:92)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:154)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:154)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByIoFile(LocalFileSystemImpl.java:85)
at it.codegen.jartool.client.actions.CreateJarAction.actionPerformed(CreateJarAction.java:92)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:23)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:15)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:54)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:1)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:112)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:129)
at com.intellij.openapi.vfs.impl.local.VirtualFileImpl.refresh(VirtualFileImpl.java:258)
at com.intellij.openapi.vfs.VirtualFile.refresh(VirtualFile.java:549)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:326)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:154)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByIoFile(LocalFileSystemImpl.java:85)
at it.codegen.jartool.client.actions.CreateJarAction.actionPerformed(CreateJarAction.java:92)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:23)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:15)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:54)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:1)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:112)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:129)
at com.intellij.openapi.vfs.impl.local.VirtualFileImpl.refresh(VirtualFileImpl.java:258)
at com.intellij.openapi.vfs.VirtualFile.refresh(VirtualFile.java:549)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:326)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByIoFile(LocalFileSystemImpl.java:85)
at it.codegen.jartool.client.actions.CreateJarAction.actionPerformed(CreateJarAction.java:92)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:23)
at com.intellij.openapi.actionSystem.impl.ActionButton.processMouseEvent(ActionButton.java:15)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:54)
at com.intellij.ide.IdeEventQueue.a(IdeEventQueue.java:1)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:112)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)



2 comments

LocalFileSystem.refreshAndFindFileByIoFile() writes stuff to disk. This
may only happen inside a write action.
Create a Runnable implementation to do the write-access you want to do
and use Application.runWriteAction(Runnable) to do those things inside a
write-action. Use ApplicationManager.getApplication() to get an
Application object.

Bas

Sanjeewa Ruwanpathirana wrote:

Ihave written the archiving plugin (Jar Tool) and with the idea

version 5.0 it gives this error message. any idea why and how can I get
rid of it. the plugin works fine even though the error apears. but it
does not refresh the project tree og the GUI


Assertion failed: Write access is allowed inside write-action only

(see com.intellij.openapi.application.Application.runWriteAction())

java.lang.Throwable
at com.intellij.openapi.diagnostic.Logger.assertTrue(Logger.java:78)
at com.intellij.openapi.application.impl.ApplicationImpl.assertWriteAccessAllowed(ApplicationImpl.java:129)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByPath(LocalFileSystemImpl.java:92)
at com.intellij.openapi.vfs.impl.local.LocalFileSystemImpl.refreshAndFindFileByIoFile(LocalFileSystemImpl.java:85)
at it.codegen.jartool.client.actions.CreateJarAction.actionPerformed(CreateJarAction.java:92)
at com.intellij.openapi.actionSystem.impl.ActionButton.performAction(ActionButton.java:23)

0

Thanks, this helped with a test of an action that calls createSubdirectory.  Creating the file itself didn't need to be in a WriteAction, but creating a directory above the file did: https://github.com/KronicDeth/intellij-elixir/commit/1c58387e6365ff34b61395c82afe1995a5070ca0.

0

Please sign in to leave a comment.