On Tue, 23 Mar 2021 13:45:33 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

> When `getAllPrinterNames()` returns null, the list of `printServices` is 
> assigned a new empty array without invalidating old services which were in 
> the array before.
> 
> The old print services should be invalidated.

src/java.desktop/windows/classes/sun/print/PrintServiceLookupProvider.java line 
116:

> 114:     private synchronized void refreshServices() {
> 115:         String[] printers = getAllPrinterNames();
> 116:         if (printers == null) {

`getAllPrinterNames` returns null when an error occurs or when there are no 
printers in the system.

Up for discussion:
If an error occurs, we may leave the old services without invalidating them. In 
this case, it is necessary to distinguish between the error and the lack of 
printers in the system. Does this make any sense?

-------------

PR: https://git.openjdk.java.net/jdk/pull/3151

Reply via email to