RFR: 8312603: ArrayIndexOutOfBoundsException in Marlin when scaleX is 0 [v4]
Ambarish Rapte
arapte at openjdk.org
Mon Feb 5 07:34:12 UTC 2024
On Fri, 2 Feb 2024 13:14:26 GMT, Laurent Bourgès <lbourges at openjdk.org> wrote:
>> Fixed scale=0 in DMarlinPrismUtils + added new test Scale0Test.java
>
> Laurent Bourgès has updated the pull request incrementally with one additional commit since the last revision:
>
> fixed tests thanks to + copyright years
tests/system/src/test/java/test/com/sun/marlin/ScaleX0Test.java line 113:
> 111:
> 112: // Restore stderr:
> 113: System.setErr(defaultErrorStream);
I missed one more thing earlier.
The sleep of 2 seconds is an uncertain time, which can be made little more specific.
- Add an onShown latch for Stage
- Capture the stderr after stage is shown and keep the sleep of 2 seconds as is
This makes it little clearer that the issue occurs after stage is shown.
Here is the change to replace above code:
CountDownLatch showLatch = new CountDownLatch(1);
Platform.runLater(() -> {
Stage stage = new Stage();
stage.setScene(scene);
stage.setOnShown(s -> showLatch.countDown());
stage.show();
});
Util.waitForLatch(showLatch, 5, "Failed to show the stage.");
// Capture stderr:
System.setErr(new PrintStream(out, true));
try {
Thread.sleep(2000L);
} catch (InterruptedException ie) {
Logger.getLogger(ScaleX0Test.class.getName()).log(Level.SEVERE, "interrupted", ie);
}
// Restore stderr:
System.setErr(defaultErrorStream);
Please check if this is a correct understanding.
I tested it several times with and without the fix: Always Failed without fix and always passed with fix.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1348#discussion_r1477764299
More information about the openjfx-dev
mailing list