On Wed, 20 Sep 2023 11:04:17 GMT, Aleksey Shipilev <sh...@openjdk.org> wrote:
>> For NullClipARGB we are throwing SkippedException only if instance of caught >> exception is PrinterException. All other exceptions are considered unrelated >> to printer configuration. >> >> For CountPrintServices we want to throw SkippedException in the case when >> lpstat is not installed, where an IOException is caught in that case. >> >> For ExceptionTest we want to throw SkippedException for all >> PrinterExceptions which were not caused by IndexOutOfBoundsException. >> >> For rest of the tests if PrintService was not created instead >> RuntimeException we are throwing now SkippedException. >> >> Tested on environment without printer installed. >> Test are passing with skipped exception as expected. >> >> Passed: java/awt/print/PrinterJob/ExceptionTest.java >> Passed: java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java >> Passed: java/awt/print/PrinterJob/PrtException.java >> Passed: javax/print/attribute/AttributeTest.java >> Passed: javax/print/attribute/GetCopiesSupported.java >> Passed: javax/print/attribute/SidesPageRangesTest.java >> Passed: javax/print/attribute/SupportedPrintableAreas.java >> Passed: javax/print/PrintServiceLookup/CountPrintServices.java >> Passed: javax/print/CheckDupFlavor.java >> >> Additionally unused imports have been removed. > > test/jdk/java/awt/print/PrinterJob/ImagePrinting/NullClipARGB.java line 43: > >> 41: >> 42: public static void main( String[] args ) { >> 43: PrintService[] svc = >> PrintServiceLookup.lookupPrintServices(DocFlavor.SERVICE_FORMATTED.PRINTABLE, >> null); > > Do we need to ask for `DocFlavor.SERVICE_FORMATTED.PRINTABLE` here? Can we > just ask for `null`? Correct me if I'm wrong, but I think if we ask for null here it may find a PrintService that does not support PRINTABLE flavor so SkippedException will not be thrown because svc.length will be greater than 0 and we may end up with an exception thrown later in pj.print(). ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/15821#discussion_r1331608828