Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8231352

[Citrix/RDP] PrintServiceLookup.lookupDefaultPrintService() does not return configured default printer when redirected

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u221, 11
    • client-libs
    • None
    • Citrix (remote desktop windows system)

    • 2d
    • generic
    • windows_10

      This bug has been originally reported at AdoptOpenJDK here:
      https://github.com/AdoptOpenJDK/openjdk-build/issues/1277

      In an Citrix remote desktop scenario on Windows 10 an incorrect default printer is being returned by javax.print.PrintServiceLookup.lookupDefaultPrintService(). Example code:

      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("Default print service name (" + printServiceName+")");
                   } else {
                          System.out.println("No default print service found.");
                   }
             }
      }

      Steps to reproduce:

      1. Logon to session Citrix or RDP
      2. set a local or network default printer
      3. run the code "PrintServiceLookupTest".
      4. set a redirected default printer
      5. run the code "PrintServiceLookupTest".

      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

      It looks like OpenJDK isn't using the correct registry key for the RDP/Citrix use case. This isn't an issue on a default host Windows OS. So a remote setup via Citrix is necessary to reproduce.

      Actual output:
      Some printer which isn't the redirected default printer.

      Expected output:
      Same as this windows query:

      > Get-WmiObject -Query " SELECT * FROM Win32_Printer" | Where-Object {$_.Default -eq "true"} | Select Name


            prr Philip Race
            sgehwolf Severin Gehwolf
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: