0

在此 netbeans 平台应用程序堆栈跟踪中,“尝试从 EDT 获取 DataObject”是什么意思:

[INFO] INFO [org.netbeans.ui.metrics.projects]: USG_PROJECT_OPEN
[INFO] WARNING [org.netbeans.TopSecurityManager]: use of system property netbeans.user has been obsoleted in favor of InstalledFileLocator at org.netbeans.modules.masterfs.providers.Attributes.getRootForAttributes(Attributes.java:104)
[INFO] WARNING [org.openide.loaders.FolderChildren..tmp.lol.Wonderland.scenes]: Attempt to obtain DataObject for /tmp/lol/Wonderland/scenes/Alice.inc@d30e0395:b749a5 from EDT
[INFO] INFO [org.openide.loaders.FolderChildren..tmp.lol.Wonderland.scenes]: Ineffective since #199391 was implemented
[INFO] java.lang.Exception: Find for /tmp/lol/Wonderland/scenes/Alice.inc@d30e0395:b749a5
[INFO]  at org.openide.loaders.FolderChildren$DelayedNode.convert(FolderChildren.java:451)
[INFO]  at org.openide.loaders.FolderChildren$DelayedNode.convert(FolderChildren.java:399)
[INFO]  at org.openide.util.lookup.InstanceContent$ConvertingItem.getInstance(InstanceContent.java:316)
[INFO]  at org.openide.util.lookup.AbstractLookup.lookup(AbstractLookup.java:421)
[INFO]  at org.openide.nodes.FilterNode$FilterLookup.lookup(FilterNode.java:2114)
[INFO]  at org.openide.nodes.FilterNode$FilterLookup.lookup(FilterNode.java:2114)
[INFO]  at povray.projects.PovRayProxyChildren.createNodes(PovRayProxyChildren.java:30)
[INFO]  at org.openide.nodes.FilterNode$Children$LazySupport$FilterNodeEntry.nodes(FilterNode.java:1895)
[INFO]  at org.openide.nodes.EntrySupport$Lazy$EntryInfo.getNode(EntrySupport.java:1645)
[INFO]  at org.openide.nodes.FilterNode$Children$LazySupport$FilterLazySnapshot.get(FilterNode.java:1741)
[INFO]  at org.openide.nodes.FilterNode$Children$LazySupport$FilterNodeEntry.nodes(FilterNode.java:1886)
[INFO]  at org.openide.nodes.EntrySupport$Lazy$EntryInfo.getNode(EntrySupport.java:1645)
[INFO]  at org.openide.nodes.FilterNode$Children$LazySupport$FilterLazySnapshot.get(FilterNode.java:1741)
[INFO]  at org.openide.nodes.FilterNode$Children$LazySupport$FilterNodeEntry.nodes(FilterNode.java:1886)
[INFO]  at org.openide.nodes.EntrySupport$Lazy$EntryInfo.getNode(EntrySupport.java:1645)
[INFO]  at org.openide.nodes.FilterNode$Children$LazySupport$FilterLazySnapshot.get(FilterNode.java:1741)
[INFO]  at org.openide.nodes.EntrySupport$Lazy$LazySnapshot.get(EntrySupport.java:1871)
[INFO]  at org.openide.nodes.EntrySupport$Lazy$LazySnapshot.get(EntrySupport.java:1858)
[INFO]  at org.openide.explorer.view.VisualizerChildren.getChildAt(VisualizerChildren.java:127)
[INFO]  at org.openide.explorer.view.VisualizerNode.getChildAt(VisualizerNode.java:321)
[INFO]  at javax.swing.tree.DefaultTreeModel.getChild(DefaultTreeModel.java:156)
[INFO]  at javax.swing.tree.FixedHeightLayoutCache$VisibleFHTreeStateNodeEnumeration.nextElement(FixedHeightLayoutCache.java:1506)
[INFO]  at javax.swing.tree.FixedHeightLayoutCache$VisibleFHTreeStateNodeEnumeration.nextElement(FixedHeightLayoutCache.java:1461)
[INFO]  at javax.swing.tree.AbstractLayoutCache.getPreferredWidth(AbstractLayoutCache.java:228)
[INFO]  at javax.swing.plaf.basic.BasicTreeUI.updateCachedPreferredSize(BasicTreeUI.java:1820)
[INFO]  at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(BasicTreeUI.java:1921)
[INFO]  at javax.swing.plaf.basic.BasicTreeUI.getPreferredSize(BasicTreeUI.java:1909)
[INFO]  at javax.swing.JComponent.getPreferredSize(JComponent.java:1634)
[INFO]  at javax.swing.ScrollPaneLayout.layoutContainer(ScrollPaneLayout.java:769)
[INFO]  at org.openide.explorer.view.TreeView$ExplorerScrollPaneLayout.layoutContainer(TreeView.java:1823)
[INFO]  at java.awt.Container.layout(Container.java:1421)
[INFO]  at java.awt.Container.doLayout(Container.java:1410)
[INFO]  at java.awt.Container.validateTree(Container.java:1507)
[INFO]  at java.awt.Container.validate(Container.java:1480)
[INFO]  at org.openide.explorer.view.TreeView.access$101(TreeView.java:151)
[INFO]  at org.openide.explorer.view.TreeView$3.run(TreeView.java:683)
[INFO]  at org.openide.util.Mutex.readAccess(Mutex.java:365)
[INFO]  at org.openide.util.Mutex$1R.run(Mutex.java:1307)
[INFO]  at org.openide.nodes.Children$ProjectManagerDeadlockDetector.execute(Children.java:1920)
[INFO]  at org.openide.util.Mutex.doWrapperAccess(Mutex.java:1326)
[INFO]  at org.openide.util.Mutex.readAccess(Mutex.java:354)
[INFO]  at org.openide.explorer.view.TreeView.validate(TreeView.java:681)
[INFO]  at javax.swing.RepaintManager.validateInvalidComponents(RepaintManager.java:670)
[INFO]  at javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1635)
[INFO]  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
[INFO]  at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:641)
[INFO]  at java.awt.EventQueue.access$000(EventQueue.java:84)
[INFO]  at java.awt.EventQueue$1.run(EventQueue.java:602)
[INFO]  at java.awt.EventQueue$1.run(EventQueue.java:600)
[INFO]  at java.security.AccessController.doPrivileged(Native Method)
[INFO]  at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
[INFO]  at java.awt.EventQueue.dispatchEvent(EventQueue.java:611)
[INFO]  at org.netbeans.core.TimableEventQueue.dispatchEvent(TimableEventQueue.java:162)
[INFO]  at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
[INFO]  at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
[INFO]  at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
[INFO]  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
[INFO]  at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
[INFO]  at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)

? 如何解决?当我打开以使用我的应用程序打开特殊项目类型 (.pov) 时会发生这种情况。它不会伤害任何东西,但会为每个 .pov-project 文件向终端输出充斥相同的消息。

编辑1

啊哈,经过一番研究,我发现 EDT 的意思是“事件调度程序线程”,其中禁止出于某种原因访问 DataObjects。这种禁止的原因是什么,我如何正确测试节点是否代表 FS 上的隐藏文件?我如何正确地为它创建单独的线程?

4

2 回答 2

1

禁止的原因是这可能导致 IO 到磁盘,因此应该在 EDT 上避免。否则 UI 可能会冻结。

有关线程及其正确用法的信息,请参阅:http ://docs.oracle.com/javase/tutorial/uiswing/concurrency/worker.html

要知道文件是否隐藏,您需要访问 java.io.File。

要访问该文件,您需要执行以下操作:

FileObject fo = DATAOBJECT.getPrimaryFile();
File = FileUtil.toFile(fo)

您将需要添加错误代码。

于 2012-05-07T18:19:51.323 回答
1

正如 Jesse Glick 在他关于此错误的帖子中所解释的那样:https ://netbeans.org/bugzilla/show_bug.cgi?id=199391

尽可能尝试寻找 FileObject 而不是 DataObject,以避免由于使用 DataObject 而导致 IO 到磁盘。

从节点对象获取 FileObject 的示例:

FileObject fileObject = (FileObject) node.getLookup().lookup(FileObject.class);

FileObject 实例可以为您提供大量信息,因为它支持 java.io.File 类上可用的大量方法

于 2015-10-22T16:29:19.650 回答