JDK-6406385 : DropTargetListener listeners are accumulated in an uncontrolled way
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 5.0u7
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2006-03-30
  • Updated: 2010-04-26
  • Resolved: 2006-03-30
Related Reports
Relates :  
Description
J2SE Version (please include all output from java -version flag):
  java version "1.5.0_07"
  Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b02)
  Java HotSpot(TM) Client VM (build 1.5.0_07-b02, mixed mode, sharing)

Does this problem occur on J2SE 1.4.x or 5.0.x ?  Yes / No (pick one)
  1.4.x YES
  5.0.x YES also for the release build 06
  1.6.0 b77 NO due to overall structural changes concerning data transfer

Operating System Configuration Information (be specific):
  Windows XP SP2 Professional / DE

Hardware Configuration Information (be specific):
  Intel Pentium Mobile on VAIO VGN-FS 1.6 GHz

Bug Description:
  The javax.swing.plaf.basic.BasicTableUI.installUI() method
  adds a default DropTargetListener instance each time it is
  called with a TransferHandler being set. Thus, listeners
  are accumulated in an uncontrolled way also causing other 
  side effects (cf. comments of enclosed sample source for 
  details).

Steps to Reproduce (be specific):
  Compile end execute the enclosed sample source and
  use debugger to check the number of DropTargetListereners
  being installed for the table ui. You may also try to start 
  dragging over the component and abort dragging in order to 
  implicitly produce a NullPointerException.

Comments
EVALUATION As the submitter mentions, this has been fixed for 1.6 with a re-architecture of DnD in Swing. This is too large a change to backport to an update release of 5.0. As such, submitter will need to use a work-around. Please see the work-around section of 4760426 for a few lines that will help solve this problem.
30-03-2006