Hi , Phil.
Why we catch Throwable(OutOfMemoryError)? Probably we can use java
generics in defaultMap in CUPSPrinter?
Code from the test:
42 if (!os.equals("linux")) {
43 System.out.println("Linux specific test. No need to
continue");
44 }
No need to continue... and continue anyway?
On 07.02.2014 2:31, Phil Race wrote:
http://cr.openjdk.java.net/~prr/8032693/
This is a fix for https://bugs.openjdk.java.net/browse/JDK-8032693
It was introduced by the JDK 8 b115 fix for
https://bugs.openjdk.java.net/browse/JDK-8022536
The root of the issue is that if you do not have a default printer set
in CUPS then
we get an NPE at line 635 (original file) of
UnixPrintServiceLookup.java de-referencing
the array returned from CUPSPrinter.getDefaultPrinter().
This caused a failure not just locating the default but *any* printer
because
the NPE went all the way back up to javax.print implementation where
it calls
getPrintServices()
Really preventing that NPE from happening is all there is to the fix
But for good measure I
1) Catch such an exception inside refreshServices() so we can continue on
2) Fix the usage of device-uri (should be printer-uri-supported)
3) Add lots more debugging to make it easier to get to the bottom of
future problems.
I'm pretty confident in this fix since I was able to reproduce the
problem
by updating CUPS so I had no default and this cures it.
I've added a regression test as best I can. Unless you have printers, but
have also no default printer its going to pass regardless.
-phil
--
Best regards, Sergey.