首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Netbeans保存挂起

Netbeans保存挂起
EN

Stack Overflow用户
提问于 2013-05-11 21:51:24
回答 2查看 1.2K关注 0票数 4

我已经实现了一个编辑器TopComponent。由于某些原因,当我保存文档时,它会抛出一个错误。下面列出的是错误。我不知道从何说起这个例外。你能分享你所知道的吗?谢谢

代码语言:javascript
复制
java.lang.IllegalArgumentException: Self-causation not permitted 
   at java.lang.Throwable.initCause(Throwable.java:458) 
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addStack(MutualExclusionSupport.java:122) 
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addStack(MutualExclusionSupport.java:109) 
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.MutualExclusionSupport.addResource(MutualExclusionSupport.java:98) 
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getOutputStream(FileObj.java:127) 
   at org.netbeans.modules.masterfs.filebasedfs.fileobjects.FileObj.getOutputStream(FileObj.java:102) 
   at org.openide.text.DataEditorSupport$Env.outputStream(DataEditorSupport.java:891) 
   at org.openide.text.CloneableEditorSupport.saveDocument(CloneableEditorSupport.java:1172) 
   at org.openide.text.DataEditorSupport.superSaveDoc(DataEditorSupport.java:602) 
   at org.openide.text.DataEditorSupport$SaveImpl.run(DataEditorSupport.java:1315) 
   at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:127) 
   at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:609) 
   at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:415) 
   at org.openide.text.DataEditorSupport.saveDocument(DataEditorSupport.java:598) 
   at org.netbeans.modules.openide.loaders.SimpleES$SaveCookieImpl.save(SimpleES.java:226) 
   at org.openide.actions.SaveAction.performAction(SaveAction.java:132) 
   at org.openide.actions.SaveAction.performAction(SaveAction.java:102) 
   at org.openide.actions.SaveAction$Delegate.actionPerformed(SaveAction.java:249) 
   at org.openide.awt.ContextAction$Performer.actionPerformed(ContextAction.java:231) 
   at org.openide.awt.ContextManager.actionPerformed(ContextManager.java:257) 
   at org.openide.awt.ContextAction.actionPerformed(ContextAction.java:109) 
   at org.openide.util.actions.ActionInvoker$1.run(ActionInvoker.java:93) 
   at org.openide.util.actions.ActionInvoker$ActionRunnable.actionPerformed(ActionInvoker.java:162) 
   at org.netbeans.core.ModuleActions.invokeAction(ModuleActions.java:109) 
   at org.netbeans.modules.openide.actions.ActionsBridgeImpl.invokeAction(ActionsBridgeImpl.java:60) 
   at org.openide.util.actions.ActionInvoker$ActionRunnable.doRun(ActionInvoker.java:153) 
   at org.openide.util.actions.ActionInvoker$2.run(ActionInvoker.java:110) 
   at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1432) 
   at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2044) 
Caused: org.openide.util.RequestProcessor$SlowItem: task failed due to 
   at org.openide.util.RequestProcessor.post(RequestProcessor.java:424) 
   at org.openide.util.actions.ActionInvoker.doPerformAction(ActionInvoker.java:114) 
   at org.openide.util.actions.ActionInvoker.invokeAction(ActionInvoker.java:99) 
   at org.openide.awt.GeneralAction$BaseDelAction.actionPerformed(GeneralAction.java:234) 
   at org.openide.windows.TopComponent.processKeyBinding(TopComponent.java:1176) 
   at javax.swing.JComponent.processKeyBindings(JComponent.java:2940) 
   at javax.swing.JComponent.processKeyEvent(JComponent.java:2842) 
   at java.awt.Component.processEvent(Component.java:6282) 
   at java.awt.Container.processEvent(Container.java:2229) 
   at java.awt.Component.dispatchEventImpl(Component.java:4861) 
   at java.awt.Container.dispatchEventImpl(Container.java:2287) 
   at java.awt.Component.dispatchEvent(Component.java:4687) 
   at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1895) 
   at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:762) 
   at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:1027) 
   at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:899) 
   at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:727) 
   at java.awt.Component.dispatchEventImpl(Component.java:4731) 
   at java.awt.Container.dispatchEventImpl(Container.java:2287) 
   at java.awt.Window.dispatchEventImpl(Window.java:2719) 
   at java.awt.Component.dispatchEvent(Component.java:4687) 
   at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:723) 
   at java.awt.EventQueue.access$200(EventQueue.java:103) 
   at java.awt.EventQueue$3.run(EventQueue.java:682) 
   at java.awt.EventQueue$3.run(EventQueue.java:680) 
   at java.security.AccessController.doPrivileged(Native Method) 
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) 
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:87) 
   at java.awt.EventQueue$4.run(EventQueue.java:696) 
   at java.awt.EventQueue$4.run(EventQueue.java:694) 
   at java.security.AccessController.doPrivileged(Native Method) 
   at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76) 
   at java.awt.EventQueue.dispatchEvent(EventQueue.java:693) 
   at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:159) 
   at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242) 
   at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161) 
   at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150) 
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146) 
   at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138) 
[catch] at java.awt.EventDispatchThread.run(EventDispatchThread.java:91) 

编辑1

我有一个dataObject和一个VisualElement子类,它们配置了一个新的mime类型的text/x-puml。一旦我把这些换成text/plain,事情就开始起作用了。我寻找text/plain,看看我是否错过了将任何东西更改为text/x-puml,我找不到任何东西。还有什么其他事情我应该更改,以将mime类型更改为text/x-puml

编辑2

现在似乎偶尔发生,但经常发生。如果我有一个定制的mime类型,我是否需要实现我自己的SaveCookie或Savable?

EN

回答 2

Stack Overflow用户

发布于 2013-05-20 19:10:41

对我来说就像是信号量问题。

系统无法保存该文件,因为该文件上存在独占锁。另一个独占锁(为保存所需)是不可能的。

尝试查看文件处理。一定是锁上了。

票数 1
EN

Stack Overflow用户

发布于 2015-04-20 21:49:45

由于重命名,我也有一个类似的错误,这是因为文件的锁。因此,我在以下文件中使用了primaryFile.lock()文件的锁:

代码语言:javascript
复制
WindowManager.getDefault().invokeWhenUIReady(new Runnable()
{
    @Override
    public void run()
    {
        if (obj.getDomainModel() != null)
        {
            String newName = obj.getDomainModel().getName();
            FileObject primaryFile = obj.getPrimaryFile();
            try
            {
                primaryFile.rename(primaryFile.lock(), newName, primaryFile.getExt());
                callback.updateTitle(newName);
            }
            catch (IOException ex)
            {
                String message = String.format("The model couldn´t be renamed to \"%s\"", newName);

                LOG.warning(message);
            }
        }
    }
});

使用它保存文件或任何情况都一样。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16502071

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档