JDK-8272342 : [TEST_BUG] java/awt/print/PrinterJob/PageDialogMarginTest.java catches all exceptions
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-08-11
  • Updated: 2021-10-08
  • Resolved: 2021-08-16
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 11 JDK 17 JDK 18 JDK 8 Other
11.0.14-oracleFixed 17.0.2Fixed 18 b11Fixed 8u321Fixed openjdk8u322Fixed
Related Reports
Relates :  
Description
The java/awt/print/PrinterJob/PageDialogMarginTest.java test catches all exceptions and always passes:

----------System.out:(2/99)----------
pageDialog - left/top from pageFormat: 1.0 1.0
pageDialog - left/top from attribute set: 1.0 1.0
----------System.err:(9/633)----------
java.lang.RuntimeException: Top margin value not updated
        at PageDialogMarginTest.main(PageDialogMarginTest.java:67)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
        at java.base/java.lang.Thread.run(Thread.java:831)
STATUS:Passed.

To reproduce, run the test. Click OK in the Page Setup dialog displayed without modifying any values. The test must fail but it does not: the test harness considers the test passed because the thrown RuntimeException is caught within the test.
Comments
11u PR: https://github.com/openjdk/jdk11u-dev/pull/377
20-09-2021

OK, so let's wait for JDK17 Updates approval first. In the meanwhile you could also open the PR for 11 :)
16-09-2021

Fix request (17u) Please consider this for 17u. Same rationale as for 11u (above comment). Patch applies cleanly after two unshuffles. Behaviour before/after is as with 11u. Thanks
16-09-2021

[~clanger], Sure OK. Also: I didn't raise a GItHub PR for this one, although on re-reading the guidance I probably should do, even though it applies clean. is that right?
16-09-2021

Fix request (8u) Same rationale as for 11u. Patch applies cleanly after two unshuffles. Behaviour before/after is as with 11u.
16-09-2021

Fix request (11u) Please consider approving this for 11u. It's a test-only change. The test always passes prior to applying the patch, even if you deliberately supply invalid values. It also localizes the UI so, in my case, the test asks me to set a margin to 2 inches, but my localized UI lists the units in mm. Patch applies clean. After applying, the UI is localized to US (so shows inches), passes if you follow the instructions, and fails if you do not, as it should.
16-09-2021

[~jdowland], can you backport this to 17u as well (and even before 11u). 17 is an LTS and I'd like to make sure backports cascade down through all relevant releases... Thx.
16-09-2021

Changeset: a5ad7720 Author: Rajat Mahajan <rajat.m.mahajan@oracle.com> Committer: Alexey Ivanov <aivanov@openjdk.org> Date: 2021-08-16 22:24:00 +0000 URL: https://git.openjdk.java.net/jdk/commit/a5ad7720d235610ad45fc341c61f164805f82a54
16-08-2021

The test should also set Locale to English to make sure the margins are displayed in inches. For me, the margins are displayed in mm which makes it less obvious.
11-08-2021