On Thu, 11 Jul 2013 13:53:14 +0200 Matthias Scholz <m...@jammerhund.de> wrote: > during my works at the SkyJUMP print code, i encountered a problem. > On my Ubuntu 12.04 box i get the message "Printer not found". The > problem only occurs, if i set a JobName attribute to the > PrintServiceLookup. This is the default in the actual code. Without a > JobName attribute i get all my printservices (printers). > I've attached a small test class. Please can anybody platforms run > this? There are two tests. The first is without a JobName attribute
Debian squeeze with Java 7 returns the list of printers from lookupPrintServices without a job name and with a job name. It does return a null pointer exception on looking up the default printer in line 29 after the second test when the default printer is not online, presumably from lookupDefaultPrintService() returning null. I think this is the expected behavior "This may return null. ... A service specified must be discovered to be valid and currently available to be returned as the default." http://docs.oracle.com/javase/7/docs/api/javax/print/PrintServiceLookup.html#lookupDefaultPrintService%28%29 -Paul mole@chicoreus:~/workspace$ lsb_release -a LSB Version: core-2.0-ia32:core-2.0-noarch:core-3.0-ia32:core-3.0-noarch:core-3.1-ia32:core-3.1-noarch:core-3.2-ia32:core-3.2-noarch Distributor ID: Debian Description: Debian GNU/Linux 6.0.7 (squeeze) Release: 6.0.7 Codename: squeeze mole@chicoreus:~/workspace$ java -version java version "1.7.0_21" Java(TM) SE Runtime Environment (build 1.7.0_21-b11) Java HotSpot(TM) Server VM (build 23.21-b01, mixed mode) mole@chicoreus:~/workspace$ java PSLTest PrintServiceLookup Test without JobName ... attributeSet.size(): 0 services.length: 7 HP_LaserJet_400_color_M451dn, HP_Officejet_100_Mobile_L411, HPColorLaserJetCP2025, LaserJet-4000, Officejet_100_Mobile_L411, PhotoSmart_P1000, PostScript-Printer, PrintServiceLookup Test with JobName ... attributeSet.size(): 1 services.length: 0 Exception in thread "main" java.lang.NullPointerException at PSLTest.main(PSLTest.java:29) -- Paul J. Morris Biodiversity Informatics Manager Harvard University Herbaria/Museum of Comparative Zoölogy m...@morris.net AA3SD PGP public key available ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ Jump-pilot-devel mailing list Jump-pilot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel