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

Variable "initialized" in class CUPSPrinter is static by mistake

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 7
    • 6
    • client-libs
    • 2d
    • b43
    • x86
    • linux

        FULL PRODUCT VERSION :
        java version "1.6.0_04"
        Java(TM) SE Runtime Environment (build 1.6.0_04-b12)
        Java HotSpot(TM) Server VM (build 10.0-b19, mixed mode)
        java version "1.5.0_14"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_14-b03)
        Java HotSpot(TM) Server VM (build 1.5.0_14-b03, mixed mode)


        ADDITIONAL OS VERSION INFORMATION :
        Suse Linus Enterprice Server 10

        output of uname -a:
        Linux <hostname> 2.6.16.21-0.8-bigsmp #1 SMP Mon Jul 3 18:25:39 UTC 2006 i686 i686 i386 GNU/Linux


        EXTRA RELEVANT SYSTEM CONFIGURATION :
        CUPS version 1.1.23

        A DESCRIPTION OF THE PROBLEM :
        Today I found yet another bug in the sun.print.CUPSPrinter class, which as well is responsible for the following NullPointerException (especially in a multi threaded application, see as well Bug ID 6390756):

            java.lang.NullPointerException
                    at sun.print.IPPPrintService.findCustomMedia(IPPPrintService.java:845)
                    at sun.print.UnixPrintJob.print(UnixPrintJob.java:328)
                    ...

        In the source of class sun.print.CUPSPrinter, I saw that the variable "initialized" was on the one hand a static variable and on the other hand used to control the initialization of instance variables (im particular the array cupsCustomMediaSNames) in method initMedia(). This of cource causes trouble when more than one CUPSPrinter instances are created, without calling initMedia() immediately after instantiation (to be precise: before the next CUPSPrinter instance is created).



        REPRODUCIBILITY :
        This bug can be reproduced often.

              jgodinez Jennifer Godinez (Inactive)
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: