JDK-8051588 : [headless] DataTransferer.getInstance throws ClassCastException in headless mode
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 8u20,8u25,8u40,9
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-07-22
  • Updated: 2016-04-19
  • Resolved: 2014-07-28
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.
JDK 8 JDK 9
8u25Fixed 9 b28Fixed
Related Reports
Duplicate :  
Relates :  
Description
In the DataTransferer.getInstance it's assumed that the default toolkit is an instance of SunToolkit, but in headless mode it's incorrect.
Comments
Removed ursqe-need-test as this is covered by JCK.
19-04-2016

Suggested test draft: java -Djava.awt.headless=true A public class A { /** * @param args the command line arguments */ public static void main(String[] args) { try { DataTransferer d = DataTransferer.getInstance(); System.out.println("d = " + d); } catch (ClassCastException cce) { System.exit(-1); //fail } System.exit(0); //pass } }
19-09-2014

api/java_awt/datatransfer tests passed on 7u71b11 with headless enabled.
28-08-2014

on jdk1.7.0_72b11, tests are passed.
28-08-2014

on 8u25, it started failing from first build onwards. i.e jdk1.8.0_25b01
28-08-2014

with headless enabled. jdk1.8.0_20b06 - passed jdk1.8.0_20b07 - failed
28-08-2014