[OpenJDK 2D-Dev]  RFR: JDK-8221412: lookupPrintServices() does not always update the list of Windows remote printers
alexey.ivanov at oracle.com
Tue Mar 26 17:01:06 UTC 2019
Please review the fix for jdk 13:
The list of printers is not updated in the situation where there are no
remote printers on the system and later the user adds a remote printer.
JDK-8153732  added a new thread which polls remote printers on the
system and updates the list if it detects a change. In this case it does
not update the print services because of this condition:
449 if (prevRemotePrinters != null && prevRemotePrinters.length > 0)
prevRemotePrinters is not null but its length is zero because no remote
printers were initially present on the system.
I removed this if. We have to update the list printers if doCompare()
returns true. Either prevRemotePrinters or currentRemotePrinters, or
both can be null; doCompare() handles this situation gracefully after
The listener called getRemotePrintersNames() twice: in constructor and
in run() before entering the first sleep. Now it's done only once.
I consolidated the implementation of getAllPrinterNames() and
getRemotePrintersNames(). They were very similar. The old implementation
of getRemotePrintersNames() got the list of both local and remote
printers and then filtered out local ones. The new implementation gets
the list of remote printers only. So the difference between the two is
limited to the flags passed to EnumPrinters.
If there are no remote printers, the new version
getRemotePrintersNames() returns null instead of empty array. As
mentioned earlier, doCompare() handles this situation.
I'll add the bugid (8221412) to the regression test when fixing
JDK-8221263 . I'm currently working on it.
Thank you in advance.
More information about the 2d-dev