RFR: 8335231: [macos] Test java/awt/print/PrinterJob/Cancel/PrinterJobCancel.java failed on macOS because the case didn't get the expected PrintAbortException [v4]
Prasanta Sadhukhan
psadhukhan at openjdk.org
Mon Aug 5 10:09:07 UTC 2024
On Sun, 4 Aug 2024 21:44:33 GMT, Phil Race <prr at openjdk.org> wrote:
> (1) The job still gets queued for printing - should it ? Ideally not if there's some thing we can do.
I guess you are testing via your standalone `PJC.java` or jtreg's `PrinterJobCancel.java` which starts the print job and after 5sec does call `PrinterJob.cancel`
so I guess it should start/queue the printjob..The printjob is supposed to print **6 pages** if it doesn't get cancelled
I see it prints the 1st page and then it aborts in normal run with the above testcase...
Are you not seeing that or am I misunderstanding your statement?
> (2) The "Error during printing" dialog I get after running the test is from macOS not us. Should it happen ?
I suspected it might be because of `abortDoc `native call but even after commenting `cancelDoc`, this dialog is coming.
> (3) There's also an NSException printed
I thought it is because of this line in `CHECK_EXCEPTION `macro
`[NSException raise:NSGenericException format:@"Java Exception"]; `
which was added by you in [JDK-8259343:[macOS] Update JNI error handling in Cocoa code.](https://bugs.openjdk.org/browse/JDK-8259343)
I found one issue where I see that `cancelDoc` exits the printingLoop and so does `completePrintLoop` called from `PrinterView.m#complete` so I think we should not be calling completePrintLoop from complete when cancelDoc is called to abort the printjob. Also, I think we should not check the CHECK_EXCEPTION also in that case
I modified the PR to do that which stops the NSException being thrown so that should solve (3) but (2) is still an enigma..
-------------
PR Comment: https://git.openjdk.org/jdk/pull/20027#issuecomment-2268693037
More information about the client-libs-dev
mailing list