JDK-8332911 : javax/print/StreamPrintingOrientation.java fails with IllegalAccessException
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8,11,23
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • Submitted: 2024-05-24
  • Updated: 2025-01-20
  • Resolved: 2025-01-20
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
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
The javax/print/StreamPrintingOrientation.java fails with IllegalAccessException because the class is not declared public:

----------messages:(7/308)----------
command: main StreamPrintingOrientation
reason: User specified action: run main/manual StreamPrintingOrientation 
...
----------System.out:(0/0)----------
----------System.err:(11/881)----------
java.lang.IllegalAccessException: class com.sun.javatest.regtest.agent.MainWrapper$MainTask cannot access a member of class StreamPrintingOrientation with modifiers "public static"
	at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:398)
	at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:709)
	at java.base/java.lang.reflect.Method.invoke(Method.java:571)
	at com.sun.javatest.regtest.agent.MainWrapper$MainTask.run(MainWrapper.java:138)
	at java.base/java.lang.Thread.run(Thread.java:1575)

JavaTest Message: Verify that the class defining the test is
JavaTest Message: declared public (test invoked via reflection)


As suggested by the diagnostic messages, the class must be declared public.

The test is declared manual, it requires the user to click OK in the Print dialog. No other interaction is required, as far as I understand.

It would be good to display instructions for the tester.
Comments
The problem is fixed by JDK-8343124.
20-01-2025

The test catches all the exceptions, thus it will never fail. The code of the test could be reformatted, simplified where applicable.
24-05-2024