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

PIT:lookupPrintServices returns an invalid printer when no def ptr is available

XMLWordPrintable

    • 2d
    • mustang
    • sparc
    • solaris_9, solaris_10
    • Verified

      I have modified the .printers file on my home directory in such a way that there is no '_default' entry in it. All it has is the '_all' entry. On Solaris, lpstat -d returns 'No System Default Destination'. lpstat -v returns all the network printers. When querying the available printers through PrintServiceLookup.lookupPrintServices(), I am getting a printer entry - 'destination'. Actually no such printer is available and lpstat -v does not report this printer. I feel this is taken from the string returned by 'lpstat -d'. On some systems, lpstat -d returns null and hence there is a 'null' printer returned by LookupPrintServices method. This is shown even in the print dialog also as the default printer. This occurs only on the PIT build on Solaris9 without CUPS. On the previous build, this throws an IllegalArgumentException. Here is the PIT build:
      java version "2d.pit-jcg-sparc-01-2004-03-31.tiger"
      Java(TM) 2 Runtime Environment, Standard Edition (build 2d.pit-jcg-sparc-01-2004-03-31.tiger)
      Java HotSpot(TM) Client VM (build 1.5.0-beta2-b45, mixed mode)

      I have attached a sample code. Execute the sample code. Click on the 'Merlin PrintService Dialog' button shown on the frame. A print dialog will popup. You will see either 'null' or 'destination' as the default printer on the printer combo box. I am printing all the printers returned by lookupPrintServices() on the console. if you find the above mentioned invalid printer in the list, the bug is reproduced. No non-existent printers must be reported by lookupPrintServices method. I could not print anything using this default printer as it throws a PrintException always.

      Here is the setup information:
      HOSTNAME: cheran.india.sun.com
      OS: Solaris - Sparc 9
      CUPS installed: NO


      cheran:/home/pm143956/PrintSamples 110 % lpstat -d
      no system default destination

      cheran:/home/pm143956/PrintSamples 111 % lpstat -v
      system for sunprintsgl: pr-cblr03-01.india
      system for cauverysgl: pr-cblr03-01.india
      system for mayuradbl: pr-cblr03-01.india
      system for sterling: pr-cblr03-01.india (as printer sterlingdbl)
      system for pounddbl: pr-cblr03-01.india
      system for kandala: pr-cmum02-01.india (as printer kandaladbl)
      system for sunprintdbl: pr-cblr03-01.india
      system for starfiresgl: pr-cblr03-01.india
      system for starfiredbl: pr-cblr03-01.india
      system for cauverydbl: pr-cblr03-01.india
      system for mayurasgl: pr-cblr03-01.india
      system for bahtdbl: pr-cblr03-01.india
      system for cents: pr-cblr03-01.india (as printer centsdbl)
      system for kapilasgl: pr-cblr03-01.india
      system for kapiladbl: pr-cblr03-01.india
      system for rupee: pr-cblr03-01.india (as printer rupeedbl)
      system for ringgitsgl: pr-cblr03-01.india
      system for photondbl: pr-cblr03-01.india
      system for ajantadbl: pr-cmum02-02.india
      system for poundsgl: pr-cblr03-01.india
      system for centssgl: pr-cblr03-01.india
      system for ringgit: pr-cblr03-01.india (as printer ringgitdbl)
      system for milkyway-pr: pr-cblr03-01.india
      system for redfortdbl: pr-cnwd03-01.india
      system for rupeesgl: pr-cblr03-01.india
      system for capital: pr-cnwd03-02.india (as printer capitaldbl)
      system for ajanta: pr-cmum02-02.india (as printer ajantadbl)
      system for baht: pr-cblr03-01.india (as printer bahtdbl)
      system for sterlingsgl: pr-cblr03-01.india
      system for mayura: pr-cblr03-01.india (as printer mayuradbl)
      system for ajantasgl: pr-cmum02-02.india
      system for startrecksgl: pr-cblr03-01.india
      system for starcatdbl: pr-cblr03-01.india
      system for kandaladbl: pr-cmum02-01.india
      system for capitalsgl: pr-cnwd03-02.india
      system for bacardidbl: pr-cblr03-01.india
      system for sunprint: pr-cblr03-01.india (as printer sunprintdbl)
      system for hoysala: pr-cblr03-01.india (as printer hoysaladbl)
      system for redfortsgl: pr-cnwd03-01.india
      system for kandalasgl: pr-cmum02-01.india
      system for bacardi: pr-cblr03-01.india (as printer bacardidbl)
      system for bacardisgl: pr-cblr03-01.india
      system for photonsgl: pr-cblr03-01.india
      system for starfire: pr-cblr03-01.india (as printer starfiredbl)
      system for customs: pr-cblr03-01.india
      system for dollar: pr-cblr03-01.india (as printer dollardbl)
      system for moonlight-pr: pr-cblr03-01.india
      system for sterlingdbl: pr-cblr03-01.india
      system for centsdbl: pr-cblr03-01.india
      system for bahtsgl: pr-cblr03-01.india
      system for kapila: pr-cblr03-01.india (as printer kapiladbl)
      system for pound: pr-cblr03-01.india (as printer pounddbl)
      system for startreckdbl: pr-cblr03-01.india
      system for ringgitdbl: pr-cblr03-01.india
      system for startreck: pr-cblr03-01.india (as printer startreckdbl)
      system for dollarsgl: pr-cblr03-01.india
      system for dollardbl: pr-cblr03-01.india
      system for rupeedbl: pr-cblr03-01.india
      system for starcatsgl: pr-cblr03-01.india
      system for hoysalasgl: pr-cblr03-01.india
      system for capitaldbl: pr-cnwd03-02.india
      system for starcat: pr-cblr03-01.india (as printer starcatdbl)
      system for redfort: pr-cnwd03-01.india (as printer redfortdbl)
      system for hoysaladbl: pr-cblr03-01.india
      system for cauvery: pr-cblr03-01.india (as printer cauverydbl)
      system for photon: pr-cblr03-01.india (as printer photondbl)

      Contents of .printers file:

      cheran:/home/pm143956 114 % cat .printers
      _all
      ------------------------------------------------------------------------------
      Here is the stack trace of IllegalArgumentException from the previous build (b45):

      java.lang.IllegalArgumentException: services must contain defaultService
      at javax.print.ServiceUI.printDialog(ServiceUI.java:161)
      at MixedPrintingTest.printThroughMerlinPrint(MixedPrintingTest.java:209)
      at MixedPrintingTest.actionPerformed(MixedPrintingTest.java:85)
      at java.awt.Button.processActionEvent(Button.java:388)
      at java.awt.Button.processEvent(Button.java:356)
      at java.awt.Component.dispatchEventImpl(Component.java:3933)
      at java.awt.Component.dispatchEvent(Component.java:3781)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:234)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

      This is seen on 1.4.1 and 1.4.2 but it is not reproducible on any of the tiger builds except the PIT build specified above. Hence this is a regression introduced in the above PIT build.

      ###@###.### 2004-04-06

            jgodinez Jennifer Godinez (Inactive)
            pmohansunw Praveen Mohan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: