我的Java应用程序中存在复制/粘贴的特定问题。我在IT部门使用IT实用程序来获取IT评估的证据。
当我尝试从任何内容进行复制时(jTextArea
,jTextField
,jTable
单元格等等。)我收到的信息显示为NullPointerException
。
这个问题随机出现,我可以复制输入/输出我想要的所有内容,但是,然后说,小时后,我想复制一些信息,然后出现,之后我无法复制任何内容或任何内容帮助是重新启动应用程序。重启之后,我可以尝试在任何地方复制任何内容,甚至可以使用Java Toolkit.getDefaultToolkit().getSystemClipboard()
函数而不会出现错误,但在一段时间后(通常在一个或多个小时之后),它会再次出现。目前,只有一个活动的调度方法可以不断地从SQL刷新主表。我认为我的代码在这里没有帮助,这个应用程序有更多的65K行,这个问题随机出现在任何地方。
但我的问题是 - 是否有任何特殊的方法来处理系统剪贴板,或者是否存在任何可能导致此类行为的常见错误?我发现没有什么可以帮助我理解我的问题。
我将非常感谢任何帮助或领导,谢谢:)
错误讯息:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at java.io.Win32FileSystem.normalize(Unknown Source)
at java.io.Win32FileSystem.getUserPath(Unknown Source)
at java.io.Win32FileSystem.resolve(Unknown Source)
at java.io.File.getAbsolutePath(Unknown Source)
at java.io.File.getAbsoluteFile(Unknown Source)
at java.io.File.toURI(Unknown Source)
at java.awt.datatransfer.SystemFlavorMap$1.run(Unknown Source)
at java.awt.datatransfer.SystemFlavorMap$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.datatransfer.SystemFlavorMap.initSystemFlavorMap(Unknown Source)
at java.awt.datatransfer.SystemFlavorMap.getFlavorToNative(Unknown Source)
at java.awt.datatransfer.SystemFlavorMap.getNativesForFlavor(Unknown Source)
at sun.awt.datatransfer.DataTransferer.getFormatsForFlavors(Unknown Source)
at sun.awt.windows.WDataTransferer.getFormatsForFlavors(Unknown Source)
at sun.awt.datatransfer.DataTransferer.getFormatsForTransferable(Unknown Source)
at sun.awt.windows.WClipboard.setContentsNative(Unknown Source)
at sun.awt.datatransfer.SunClipboard.setContents(Unknown Source)
at GUI.Evidence.EvidenceMain.SaveToClip(EvidenceMain.java:711)
at GUI.Evidence.EvidenceMain.access$800(EvidenceMain.java:65)
at GUI.Evidence.EvidenceMain$4.mouseReleased(EvidenceMain.java:401)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
java.io.IOException: cannot transfer non-text data as Reader
at sun.awt.datatransfer.DataTransferer.translateTransferable(Unknown Source)
at sun.awt.windows.WDataTransferer.translateTransferable(Unknown Source)
at sun.awt.windows.WClipboard.setContentsNative(Unknown Source)
at sun.awt.datatransfer.SunClipboard.setContents(Unknown Source)
at javax.swing.TransferHandler.exportToClipboard(Unknown Source)
at javax.swing.TransferHandler$TransferAction.actionPerformedImpl(Unknown Source)
at javax.swing.TransferHandler$TransferAction.access$700(Unknown Source)
at javax.swing.TransferHandler$TransferAction$1.run(Unknown Source)
at javax.swing.TransferHandler$TransferAction$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at javax.swing.TransferHandler$TransferAction$2.run(Unknown Source)
at javax.swing.TransferHandler$TransferAction$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at javax.swing.TransferHandler$TransferAction.actionPerformed(Unknown Source)
at javax.swing.text.JTextComponent.invokeAction(Unknown Source)
at javax.swing.text.JTextComponent.copy(Unknown Source)
at javax.swing.text.DefaultEditorKit$CopyAction.actionPerformed(UnknownSource)
at javax.swing.SwingUtilities.notifyAction(Unknown Source)
at javax.swing.JComponent.processKeyBinding(Unknown Source)
at javax.swing.JComponent.processKeyBindings(Unknown Source)
at javax.swing.JComponent.processKeyEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.KeyboardFocusManager.redispatchEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(Unknown Source)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)