-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
6
-
x86
-
linux
FULL PRODUCT VERSION :
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-rc-b104, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux kowhai 2.6.16.28-xen-dom0 #4 SMP Mon Sep 25 18:45:18 BST 2006 x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
At least two print services must be installed to reproduce this bug
A DESCRIPTION OF THE PROBLEM :
PrintService.getSupportedAttributeValues throws a NullPointerException when called from multiple threads.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the given code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
To run without throwing any exceptions, and to print the media count for each print service installed on that machine.
ACTUAL -
A NullPointerException was thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "Thread-2" java.lang.NullPointerException
at sun.print.IPPPrintService.getSupportedAttributeValues(IPPPrintService
.java:515)
at GetMediasTest$1.run(GetMediasTest.java:11)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.standard.Media;
public class GetMediasTest {
public static void main(String[] args) {
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
for(final PrintService service: services) {
Thread thread = new Thread() {
public void run() {
service.getSupportedAttributeValues(Media.class, null, null);
}
};
thread.start();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Replace the contents of the run method with:
synchronized (GetMediasTest.class) {
service.getSupportedAttributeValues(Media.class, null, null);
}
java version "1.6.0-rc"
Java(TM) SE Runtime Environment (build 1.6.0-rc-b104)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0-rc-b104, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Linux kowhai 2.6.16.28-xen-dom0 #4 SMP Mon Sep 25 18:45:18 BST 2006 x86_64 Intel(R) Core(TM)2 CPU 6600 @ 2.40GHz GenuineIntel GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
At least two print services must be installed to reproduce this bug
A DESCRIPTION OF THE PROBLEM :
PrintService.getSupportedAttributeValues throws a NullPointerException when called from multiple threads.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the given code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
To run without throwing any exceptions, and to print the media count for each print service installed on that machine.
ACTUAL -
A NullPointerException was thrown.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Exception in thread "Thread-2" java.lang.NullPointerException
at sun.print.IPPPrintService.getSupportedAttributeValues(IPPPrintService
.java:515)
at GetMediasTest$1.run(GetMediasTest.java:11)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.attribute.standard.Media;
public class GetMediasTest {
public static void main(String[] args) {
PrintService[] services = PrintServiceLookup.lookupPrintServices(null, null);
for(final PrintService service: services) {
Thread thread = new Thread() {
public void run() {
service.getSupportedAttributeValues(Media.class, null, null);
}
};
thread.start();
}
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Replace the contents of the run method with:
synchronized (GetMediasTest.class) {
service.getSupportedAttributeValues(Media.class, null, null);
}
- duplicates
-
JDK-6653384 Variable "initialized" in class CUPSPrinter is static by mistake
-
- Resolved
-