JDK-8232511 : The redirected default printer not return on Citrix Xendekstop and RDP Session
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.swing
  • Affected Version: 8u231,11.0.4,13,14
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86_64
  • Submitted: 2019-09-18
  • Updated: 2020-07-19
  • Resolved: 2020-07-19
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
tbdResolved
Related Reports
Duplicate :  
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
Platform:
Windows 10 LTSC 2019 and Windows Server 2016/2019

Architecture:
x64

Any Java Runtime

A DESCRIPTION OF THE PROBLEM :
Hi support,
the problem occurs in Citrix or RDP session when you set a default printer redirected.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Logon to session Citrix or RDP
2. set a local or network default printer (Microsoft Print to PDF)
3. run the code "PrintServiceLookupTest".
4. set a redirected default printer (Invia a OneNote 16 (from WKST015))
5. run the code "PrintServiceLookupTest".


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Print Service Default Name is (Invia a OneNote 16 (from WKST015))
ACTUAL -
Print Service Default Name is (Microsoft Print to PDF)

---------- BEGIN SOURCE ----------
public class PrintServiceLookupTest {
       public static void main(String[] args) {
             javax.print.PrintService service = javax.print.PrintServiceLookup.lookupDefaultPrintService();
             if (service != null) {
                    String printServiceName = service.getName();
                    System.out.println("Stampante di default (" + printServiceName+")");
             } else {
                    System.out.println("Nessuna stampante di default trovata");
             }
       }
}
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
The registry key used for local or network printers is:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device

The registry key used for redirect printers is:

HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows\SessionDefaultDevices\ "session" \Device

In these links you can find workarounds, but only until you change your default printer

https://social.msdn.microsoft.com/Forums/en-US/59199e98-4db0-4a73-90ef-52ba8f072153/default-printer-registry-key-not-set-correctly-on-windows-server-20162019?forum=servervirtualization

https://social.technet.microsoft.com/Forums/ie/en-US/a56e481e-6bd5-44dc-8873-d2c58e7e1948/bug-hkcu-default-printer-registry-key-isnt-set-properly-in-windows-server-2016?forum=ws2016

https://discussions.citrix.com/topic/396513-windows-server-2016-and-xenapp-715-cu2-default-printer-registry-key-not-set-when-launching-published-app/

My case to AdoptOpenJDK
https://github.com/AdoptOpenJDK/openjdk-build/issues/1277

FREQUENCY : always



Comments
As per description, when a default printer is setup redirected on Citrix Xendesktop/RDP session, it fails to return default printer. The issue is reproducible with using RDP. Result from RDP run (JDK 11.0.4, 13.0.1, 14 ea b18, 8u231) ====================== Local or Network default printer (Microsoft Print to PDF) > java PrintServiceLookupTest Stampante di default (Microsoft Print to PDF) With redirected default printer (blr-***-prn1 (redirected 2) > java PrintServiceLookupTest Stampante di default (Microsoft Print to PDF)
17-10-2019