On Thu, 5 Mar 2026 12:01:03 GMT, Alexey Ivanov <[email protected]> wrote:
>> What's the point of the null-check if the condition `range != null` is >> always `true`? >> >> I left [a more detailed >> comment](https://github.com/openjdk/jdk/pull/29874/changes#r2889362143) to >> the NPE discussion. > > Is it possible to close the dialog by sending `VK_ENTER`? If it is and the > test is stable, it can be automatic. I did try that but it seems to timeout in macox-aarch64 consistenly in CI although the test passes locally public class TestPrintNoException { public static void main(String[] args) throws Exception { Robot robot = new Robot(); Thread t = new Thread (() -> { robot.delay(5000); robot.keyPress(KeyEvent.VK_ENTER); robot.keyRelease(KeyEvent.VK_ENTER); robot.waitForIdle(); }); Toolkit tk = Toolkit.getDefaultToolkit(); PrintJob pj = null; int[][] pageRange = new int[][]{new int[]{1,1}}; JobAttributes ja = new JobAttributes(1, java.awt.JobAttributes.DefaultSelectionType.ALL, JobAttributes.DestinationType.PRINTER, JobAttributes.DialogType.NATIVE, null, Integer.MAX_VALUE, 1, JobAttributes.MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, pageRange, "", JobAttributes.SidesType.ONE_SIDED); Frame testFrame = new Frame("print"); try { if (tk != null) { t.start(); pj = tk.getPrintJob(testFrame, null, ja, null); } } finally { testFrame.dispose(); } } } ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/29874#discussion_r2889681745
