changeset 3178:386b49abc195

6945178: SecurityException upon drag-and-drop Summary: A flag added to distinguish drop action handling. Reviewed-by: uta, art
author denis
date Wed, 01 Dec 2010 17:25:12 +0300
parents 23a3e724ee9d
children df99592ad34f
files src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Dec 01 14:43:56 2010 +0300
+++ b/src/share/classes/sun/awt/dnd/SunDropTargetContextPeer.java	Wed Dec 01 17:25:12 2010 +0300
@@ -94,6 +94,11 @@
     protected int                     dropStatus   = STATUS_NONE;
     protected boolean                 dropComplete = false;
 
+    // The flag is used to monitor whether the drop action is
+    // handled by a user. That allows to distinct during
+    // which operation getTransferData() method is invoked.
+    boolean                           dropInProcess = false;
+
     /*
      * global lock
      */
@@ -220,7 +225,7 @@
 
         SecurityManager sm = System.getSecurityManager();
         try {
-            if (!dropComplete && sm != null) {
+            if (!dropInProcess && sm != null) {
                 sm.checkSystemClipboardAccess();
             }
         } catch (Exception e) {
@@ -526,6 +531,8 @@
                     setCurrentJVMLocalSourceTransferable(null);
             }
 
+            dropInProcess = true;
+
             try {
                 ((DropTargetListener)dt).drop(new DropTargetDropEvent(dtc,
                                                                       hots,
@@ -538,6 +545,7 @@
                 } else if (dropComplete == false) {
                     dropComplete(false);
                 }
+                dropInProcess = false;
             }
         } else {
             rejectDrop();