JDK-7080289 : AWTKeystroke class registers a subclass factory during deserialization
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.2_34,5.0u32
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2011-08-17
  • Updated: 2011-12-29
  • Resolved: 2011-10-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other JDK 6 JDK 7 JDK 8
1.4.2_35Fixed 6u30Fixed 7u2Fixed 8Fixed
Related Reports
Relates :  
Relates :  
Description
see comments

Comments
EVALUATION Exact point where exception occurs is a call to a sub-class constructor in AWTKeyStroke.registerSubclass() method: Constructor ctor = getCtor(subclass); String couldNotInstantiate = "subclass could not be instantiated"; if (ctor == null) throw new IllegalArgumentException(couldNotInstantiate); } try { AWTKeyStroke stroke = (AWTKeyStroke)ctor.newInstance(null); if (stroke == null) { throw new IllegalArgumentException(couldNotInstantiate); } } catch ... So the line AWTKeyStroke stroke = (AWTKeyStroke)ctor.newInstance(null); is the point where exception triggers. The exact cause of the exception - there're 5 possible exceptions that are catched - is still not fully clear to me. I'm going to analyse the test routine.
29-08-2011

EVALUATION This regression is introduced by CR 7068047 ("DnDMerlinQLTestsuite_DnDJTextArea test fails with an java.awt.dnd.InvalidDnDOperationException"). The faulty method is AWTKeyStroke.readResolve(): protected Object readResolve() throws java.io.ObjectStreamException { synchronized (AWTKeyStroke.class) { Class newClass = getClass(); Class awtKeyStrokeClass = getAWTKeyStrokeClass(); if (!newClass.equals(awtKeyStrokeClass)) { registerSubclass(newClass); } return getCachedStroke(keyChar, keyCode, modifiers, onKeyRelease); } } Judging from the exception stack trace, newClass is invalid and registerSubclass(newClass) fails, triggering an exception.
24-08-2011