1.3.6 bug reports: Windows Clipboard problems

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

1.3.6 bug reports: Windows Clipboard problems

Felix Natter
Administrator
hi Blair, hi Dimitry,

concerning the following problem:

January 21, 2014, 20:15
at 2014-01-21 20:15:41 CMT,  hash 754627f484e9520533b74b60ef2dfa49
previous report : at 2014-01-21 10:54:49 CMT,  hash be5f17ebe62933b63327b12de734535d
freeplane_version = 1.3.6 beta; freeplane_xml_version = freeplane 1.3.0
bzr revision = 231e505_dpolivaev_2014-01-132236040100
java_version = 1.7.0_45; os_name = Windows 7; os_version = 6.1
Exception in thread "AWT-EventQueue-0"
java.lang.IllegalStateException: cannot open system clipboard
        at sun.awt.windows.WClipboard.openClipboard(Native Method)
        at sun.awt.datatransfer.ClipboardTransferable.<init>(Unknown Source)
        at sun.awt.datatransfer.SunClipboard.getContents(Unknown Source)
        at org.freeplane.view.swing.map.mindmapmode.EditNodeTextField$2.actionPerformed(EditNodeTextField.java:424)
        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)

=> this is a known problem:
  http://stackoverflow.com/questions/14489733/error-cannot-open-system-clipboard-trying-to-set-system-clipboard-fails-works
=> Quick+Dirty-Fix: catch exception, wait 100ms, try again, throw exception if that fails again

It seems Toolkit.getDefaultToolkit().getSystemClipboard() is only called
in
  org.freeplane.view.swing.map.mindmapmode.EditNodeTextField.EditNodeTextField(NodeModel,
  ZoomableLabel, String, IEditControl)
so this should be an easy fix?

Best Regards,
--
Felix Natter
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.3.6 bug reports: Windows Clipboard problems

BArchibald
Hi Felix,

An alternative is that we give the user a message to inform them the clipboard is busy and to try again later (or write a proper poller but this could slow things down significantly - it's also a lot of work for one fix).

This avoids us needing to add in sleeps and a double exception handler (to try twice).

This also means we never "fail" fully - for example if 100ms wasn't enough then the user simply gets another message and not an error (errors are more scary than a helpful "System clipboard in use, please try again later.").

What do you think?

Many thanks,
Blair


On 8 February 2014 08:48, Felix Natter [via Freeplane Developer] <[hidden email]> wrote:
hi Blair, hi Dimitry,

concerning the following problem:

January 21, 2014, 20:15
at 2014-01-21 20:15:41 CMT,  hash 754627f484e9520533b74b60ef2dfa49
previous report : at 2014-01-21 10:54:49 CMT,  hash be5f17ebe62933b63327b12de734535d
freeplane_version = 1.3.6 beta; freeplane_xml_version = freeplane 1.3.0
bzr revision = 231e505_dpolivaev_2014-01-132236040100
java_version = 1.7.0_45; os_name = Windows 7; os_version = 6.1
Exception in thread "AWT-EventQueue-0"
java.lang.IllegalStateException: cannot open system clipboard
        at sun.awt.windows.WClipboard.openClipboard(Native Method)
        at sun.awt.datatransfer.ClipboardTransferable.<init>(Unknown Source)
        at sun.awt.datatransfer.SunClipboard.getContents(Unknown Source)
        at org.freeplane.view.swing.map.mindmapmode.EditNodeTextField$2.actionPerformed(EditNodeTextField.java:424)
        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)

=> this is a known problem:
  http://stackoverflow.com/questions/14489733/error-cannot-open-system-clipboard-trying-to-set-system-clipboard-fails-works
=> Quick+Dirty-Fix: catch exception, wait 100ms, try again, throw exception if that fails again

It seems Toolkit.getDefaultToolkit().getSystemClipboard() is only called
in
  org.freeplane.view.swing.map.mindmapmode.EditNodeTextField.EditNodeTextField(NodeModel,
  ZoomableLabel, String, IEditControl)
so this should be an easy fix?

Best Regards,
--
Felix Natter



If you reply to this email, your message will be added to the discussion below:
http://freeplane-developer.996965.n3.nabble.com/1-3-6-bug-reports-Windows-Clipboard-problems-tp134.html
To start a new topic under Freeplane Developer, email [hidden email]
To unsubscribe from Freeplane Developer, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 1.3.6 bug reports: Windows Clipboard problems

Dimitry Polivaev
Administrator
In reply to this post by Felix Natter
1. Java runtime library handles it by emitting a user message as follows:

javax.swing.TransferHandler.TransferAction.actionPerformedImpl(ActionEvent){
...
                // any of these calls may throw IllegalStateException
                 try {
                     if ((clipboard != null) && (th != null) && (name != null)) {
                         if ("cut".equals(name)) {
                             th.exportToClipboard(c, clipboard, MOVE);
                         } else if ("copy".equals(name)) {
                             th.exportToClipboard(c, clipboard, COPY);
                         } else if ("paste".equals(name)) {
                             trans = clipboard.getContents(null);
                         }
                     }
                 } catch (IllegalStateException ise) {
                     // clipboard was unavailable
                     UIManager.getLookAndFeel().provideErrorFeedback(c);
                     return;
                 }

...
}

2. In freeplane there are different places where clipboard.getContents() is called, and I think we
could use and implement the error handling in
org.freeplane.features.clipboard.ClipboardController.getClipboardContents().


Loading...