>Yes. But the problem was that 1) whenever there was any insecure access to the clipboard all successive calls would use this local clipboard.

Yes, if the situation changes in the way that the access to the system clipboard is now permitted, the system clipboard must be returned. This patch fixes this.

I am not sure about the security problem. If it is still dangerous to have the VM-local clipboard in this case, maybe to use the component-local clipboard? Or none? Waiting for more opinions.

2005-11-22  Audrius Meskauskas  <[EMAIL PROTECTED]>

       * javax/swing/TransferHandler
(getClipboard): Aways check for the possibility to access the system clipboard.


Index: javax/swing/TransferHandler.java
===================================================================
RCS file: /cvsroot/classpath/classpath/javax/swing/TransferHandler.java,v
retrieving revision 1.11
diff -u -r1.11 TransferHandler.java
--- javax/swing/TransferHandler.java    13 Nov 2005 20:18:42 -0000      1.11
+++ javax/swing/TransferHandler.java    22 Nov 2005 15:01:36 -0000
@@ -84,28 +84,22 @@
      */
     private static Clipboard getClipboard(JComponent component)
     {
-      // Avoid throwing exception if the system clipboard access failed
-      // in the past.
-      if (clipboard != null)
-        return clipboard;
-      else
+      try
         {
-          try
-            {
-              SecurityManager sm = System.getSecurityManager();
-              if (sm != null)
-                sm.checkSystemClipboardAccess();
+          SecurityManager sm = System.getSecurityManager();
+          if (sm != null)
+            sm.checkSystemClipboardAccess();
 
-              // We may access system clipboard.
-              return component.getToolkit().getSystemClipboard();
-            }
-          catch (Exception e)
-            {
-              // We may not access system clipboard.
-              // Create VM-local clipboard if none exists yet.
-              clipboard = new Clipboard("Clipboard");
-              return clipboard;
-            }
+          // We may access the system clipboard.
+          return component.getToolkit().getSystemClipboard();
+        }
+      catch (Exception e)
+        {
+          // We may not access system clipboard.
+          // Create VM-local clipboard if none exists yet.
+          if (clipboard == null)
+            clipboard = new Clipboard("Clipboard");
+          return clipboard;
         }
     }
   }
_______________________________________________
Classpath-patches mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to