On Fri, 12 Mar 2021 12:30:13 GMT, Alexey Ivanov <aiva...@openjdk.org> wrote:

>> I can understand that as a user, you cannot /shouldn't change the name of a 
>> remote network printer but a network admin can change the name, so shouldn't 
>> we get notification on that name change when this method gets called after 
>> the name change? or would it be notified as a new printer in that case? Then 
>> what will happen to the old stale printer in the registry?
>
> You can't. Try it yourself. The printer connection is per-user, after all 
> it's stored under HKCU.
> 
> Windows displays the name of remote printers as “Generic / Text Only on 
> 192.168.1.18”: _the name of the printer_ and _the remote host_.
> 
> If you open the *Printer Properties* dialog of a remote printer and edit its 
> name, you change the name of the printer on the remote host which shares it. 
> It changes *absolutely nothing* on the local system.
> 
>> shouldn't we get notification on that name change when this method gets 
>> called after the name change?
> 
> Yes, we should. But we cannot.
> 
> For Windows, nothing has changed on the local system, it's the remote system 
> that has been changed.
> 
>> or would it be notified as a new printer in that case?
> 
> No, it wouldn't _because nothing has changed on the local system_.
> 
>> Then what will happen to the old stale printer in the registry?
> 
> Nothing, again. It just stays there but Windows reports an error if you try 
> to open its Printer Properties, Windows reports an error if you try to print 
> to it. I tried printing with Java and Notepad: the behaviour is the same. The 
> difference is that Notepad displays the error message whereas Java throws an 
> exception (it depends on the Java app, I guess).
> 
> The behaviour aligns to the one seen when the printer is unreachable because 
> of, let's say, network issues.

OK.

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

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

Reply via email to