JDK-6941574 : 1.6.0_19 Update doesn't allow unsigned Applets to be Drag and Drop target
  • Type: Bug
  • Component: deploy
  • Sub-Component: plugin
  • Affected Version: 6u19
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_vista
  • CPU: x86
  • Submitted: 2010-04-07
  • Updated: 2011-02-16
  • Resolved: 2010-05-10
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
JRE version 1.6.0_19-b04

ADDITIONAL OS VERSION INFORMATION :
Windows Vista Home Basic

EXTRA RELEVANT SYSTEM CONFIGURATION :

A DESCRIPTION OF THE PROBLEM :
An applet (drag source) can't transfer data to another one (drop target) via Drag and Drop.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Implement an Applet that receives DnD content, display it in a browser and Drag and Drop any appropriate object on to it.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The applet receives Drag and Drop content.
ACTUAL -
Since update 1.6.0_19  drop security  exception is raised.


ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "AWT-EventQueue-8" java.security.AccessControlException: access denied
 (java.awt.AWTPermission accessClipboard)
        at java.security.AccessControlContext.checkPermission(Unknown Source)
        at java.security.AccessController.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkPermission(Unknown Source)
        at java.lang.SecurityManager.checkSystemClipboardAccess(Unknown Source)
        at sun.awt.dnd.SunDropTargetContextPeer.getTransferData(Unknown Source)
        at sun.awt.datatransfer.TransferableProxy.getTransferData(Unknown Source)
        at java.awt.dnd.DropTargetContext$TransferableProxy.getTransferData(Unknown Source)
        ...


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
import java.awt.*;
import java.awt.dnd.*;
import java.awt.datatransfer.*;

public class DndApplet extends javax.swing.JApplet {
    public void init() {
	DropTarget dt = new DropTarget(this, new DropTargetAdapter() {
	    public void drop(DropTargetDropEvent dtde) {
		Transferable transferable = dtde.getTransferable();
	    	DataFlavor[] flavors = transferable.getTransferDataFlavors();
		for(int i=0; i < flavors.length; i++) {
	    	    DataFlavor flavor = flavors[i];
    		    Class repClass = flavor.getRepresentationClass();
	    	    if (repClass.equals(String.class)) {
            		dtde.acceptDrop(dtde.getSourceActions());
	    		try {
		    	    Object object = transferable.getTransferData(flavor);
			    System.out.println("Accepted string "+object);
			    return;
			}
			catch (Exception ex) {
		    	    	ex.printStackTrace();
    	    		}
		    }
    	    	}
		dtde.rejectDrop();
	    }
	});
    }
}

---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
No Workaround.
This doesn't work even if the drag source is another applet located at the same codebase.

Release Regression From : 6u18
The above release value was the last known release where this 
bug was not reproducible. Since then there has been a regression.

Comments
EVALUATION This is the expected behavior due to the security fix for 6887703 in 6u19. To workaround the issue, either sign the applet or add AWTPermission.accessClipboard permission in the .java.policy. There's another CR 6945178 with the same issue. Closing it as a duplicate.
10-05-2010