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

PrintServiceLookup.registerService() allows to register the same class

XMLWordPrintable

    • 2d
    • beta
    • generic
    • generic

      Name: vtR10009 Date: 03/19/2001



        The spec for javax.print.PrintServiceLookup.registerService(PrintService)
      reads:
      "... The method returns true is this is service is not previously registered and
      is now successfully registered." ..."
      Returns:
                if the service could be newly registered."..."
                  
        But, merlin b56 API implementation, registerService(PrintService) allows to
      successfully register the same class twice.
      The following test shows this:
      ------------------------------------------------------------------------
      import javax.print.PrintService;
      import javax.print.PrintServiceLookup;

      public class test{

          public static void main(String args[])
          {
              PrintService pServ = new MyPrintService();
          
              if (PrintServiceLookup.registerService(pServ)){
                  if (PrintServiceLookup.registerService(pServ)){
                          System.out.println("Error. The same PrintService was "
                                  +"registered twice!");
                  }
              }

          }
      }
      ------------------------------------------------------------------------
      novo101:tmp$ java test
      Error. The same PrintService was registered twice!
      novo101:tmp$ java -version
      java version "1.4.0-beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b56)
      Java HotSpot(TM) Client VM (build 1.4-beta-B56, mixed mode)
      -------------------------------------------------------------------------

      Due to this new JCK test fails:
      api/javax_print/PrintServiceLookup/index.html#PrintServiceLookup[PrintServiceLookup3002]

      ======================================================================

            jgodinez Jennifer Godinez (Inactive)
            vitcsunw Vitc Vitc (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: