JDK-4699268 : PrintServiceLookup cannot locate many services
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 1.4.1
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2002-06-07
  • Updated: 2002-06-08
  • Resolved: 2002-06-08
Related Reports
Duplicate :  
Description

Name: vtR10009			Date: 06/07/2002


Implementation of javax.print.PrintServiceLookup abstract class cannot
locate all print services if a large number of services (~900 in SWAN) 
are available in the system.

This bug causes failure of JCK tests:
api/javax_print/CancelablePrintJob/index.html#Cancel
api/javax_print/DocPrintJob/index.html#AttributeListener 
api/javax_print/DocPrintJob/index.html#Get
api/javax_print/DocPrintJob/index.html#JobListener
api/javax_print/PrintService/index.html#hashCode

The following test hangs running on JDK 1.4.1-beta-b14:
------------------------------- test.java --------------------------------
import javax.print.*;
import javax.print.attribute.*;
import javax.print.event.*;

public class test{
    public static void main(String args[]) {
        PrintService[] pservices;
        
        pservices = PrintServiceLookup.lookupPrintServices(null, null);

        if (pservices.length == 0){
            System.out.println("OKAY: no print services found");
            System.exit(0);
        }
        System.out.println("Number of services: " + pservices.length);
        for (int i = 0; i < pservices.length; i++) {
            System.out.println(" Pservice: " + pservices[i] + " " 
                    +  pservices[i].getName());
        }

        System.exit(0);
    }
}
--------------------------------------------------------------------------

The log of test execution is following (the test was interrupted with ^C):

---------------------------Logs-------------------------------------------
$ java -version
java version "1.4.1-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1-beta-b14)
Java HotSpot(TM) Client VM (build 1.4.1-beta-b14, mixed mode)
$ javac -d . test.java
$ time java test; echo $?
^CNumber of services: 1
 Pservice: Unix Printer : sca14p12 sca14p12

real    15m14.786s
user    0m5.130s
sys     0m2.600s
130
$
--------------------------------------------------------------------------
======================================================================