JDK-6653384 : Variable "initialized" in class CUPSPrinter is static by mistake
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: linux
  • CPU: x86
  • Submitted: 2008-01-22
  • Updated: 2011-02-16
  • Resolved: 2009-01-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6 JDK 7
6u12Fixed 7 b43Fixed
Related Reports
Duplicate :  
Duplicate :  
Relates :  
Description
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.

Comments
EVALUATION As described, need to remove static and synchronize initMedia.
11-11-2008