JDK-6957937 : Applet Drag N Drop broken since 1.6.0 update 19
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u10
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-06-02
  • Updated: 2012-03-20
  • Resolved: 2010-10-19
Related Reports
Duplicate :  
Description
FULL PRODUCT VERSION :
JRE 1.6.0 Update 20

ADDITIONAL OS VERSION INFORMATION :
Microsoft Windows XP [Version 5.1.2600]

EXTRA RELEVANT SYSTEM CONFIGURATION :
JRE 1.6.0 Update 20
Internet Explorer 7

A DESCRIPTION OF THE PROBLEM :
We have an applet that requires Drag N Drop within itself. So we have a bunch of panels and we need to drag and drop child panels from one panel to another.

The Drag N Drop used to work perfectly till 1.6.0 Update 18 but since Update 19 its broken. I have updated to the latest version which seems to be update 20 and it's still broken.

The following is a simple stack trace of the exception in the Java Console when running the applet in Internet Explorer 7:-

Exception in thread "AWT-EventQueue-2" 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)

While tracking the changes to the SunDropTargetContextPeer.java it was noticed that the following code was added on Mon Mar 01 07:17:27 2010 -0800 as a result of 	6887703: Unsigned applet can retrieve the dragged information before drop action occur

 SecurityManager sm = System.getSecurityManager();

 try {
   if (!dropComplete && sm != null) {
     sm.checkSystemClipboardAccess();
   }
 } catch (Exception e) {
     Thread currentThread = Thread.currentThread();
     currentThread.getUncaughtExceptionHandler().uncaughtException(currentThread, e);
     return null;
 }

However, since we are simply utilizing the drag n drop within the applet, we do not want to access the system clipboard and thus do not want to sign our applet.

Please address the issue as its a generic problem where the java demo's utilizing drag n drop are broken as well. e.g. Similar exception is thrown when utilizing Drag N Drop in http://java.sun.com/docs/books/tutorial/uiswing/dnd/textpaste.html

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please test the Drag N Drop functionality on http://java.sun.com/docs/books/tutorial/uiswing/dnd/textpaste.html in both 1.6.0 Update 18 and 1.6.0 Update 19 to see the exception.

Its still broken in 1.6.0 Update 20.

EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No Exceptions should be thrown when utilizing Drag N Drop
ACTUAL -
NullPointerException as detailed above due to security check.

REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
Please look at the demo at http://java.sun.com/docs/books/tutorial/uiswing/dnd/textpaste.html
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
I have modified the Control Panel > Java  to utilize 1.6.0 update 18 but we cannot ask our customers to do that.