-
Bug
-
Resolution: Fixed
-
P4
-
6
-
b11
-
x86
-
linux
FULL PRODUCT VERSION :
chuck@moth:~> java -version
java version "1.6.0_01-ea"
Java(TM) SE Runtime Environment (build 1.6.0_01-ea-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-ea-b03, mixed mode)
chuck@moth:~>
ADDITIONAL OS VERSION INFORMATION :
Linux moth 2.6.13-15.13-default #1 Tue Nov 28 13:43:50 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
SUSE 10.2 (boxed) on AMD 64
A DESCRIPTION OF THE PROBLEM :
Following class throws NPE -- should not.
package experimental;
import java.awt.Font;
import javax.swing.DebugGraphics;
public class DebugGraphicsNullPointer {
private DebugGraphics dgraph;
private Font font;
public DebugGraphicsNullPointer() {
}
public static void main(String[] args) {
DebugGraphicsNullPointer pointer = new DebugGraphicsNullPointer();
pointer.runTest();
}
private void runTest() {
dgraph = new DebugGraphics();
font = new Font("Currier", Font.PLAIN, 10);
if(font == null) {
System.out.println("The font object is null"); // does not execute
}
dgraph.setFont(font); // this line throws NPE @ DebugGraphics line 185
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
should run clean or output the text
ACTUAL -
throws NPE
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Compiling 1 source file to /programs/Infosys/client/build/classes
compile-single:
run-single:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.DebugGraphics.setFont(DebugGraphics.java:185)
at experimental.DebugGraphicsNullPointer.runTest(DebugGraphicsNullPointer.java:43)
at experimental.DebugGraphicsNullPointer.main(DebugGraphicsNullPointer.java:33)
Java Result: 1
BUILD SUCCESSFUL (total time: 10 seconds)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package experimental;
import java.awt.Font;
import javax.swing.DebugGraphics;
/**
*
* @author chuck
*/
public class DebugGraphicsNullPointer {
private DebugGraphics dgraph;
private Font font;
/** Creates a new instance of DebugGraphicsNullPointer */
public DebugGraphicsNullPointer() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DebugGraphicsNullPointer pointer = new DebugGraphicsNullPointer();
pointer.runTest();
}
private void runTest() {
dgraph = new DebugGraphics();
font = new Font("Currier", Font.PLAIN, 10);
if(font == null) {
System.out.println("The font object is null");
}
dgraph.setFont(font);
}
}
---------- END SOURCE ----------
chuck@moth:~> java -version
java version "1.6.0_01-ea"
Java(TM) SE Runtime Environment (build 1.6.0_01-ea-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_01-ea-b03, mixed mode)
chuck@moth:~>
ADDITIONAL OS VERSION INFORMATION :
Linux moth 2.6.13-15.13-default #1 Tue Nov 28 13:43:50 UTC 2006 x86_64 x86_64 x86_64 GNU/Linux
EXTRA RELEVANT SYSTEM CONFIGURATION :
SUSE 10.2 (boxed) on AMD 64
A DESCRIPTION OF THE PROBLEM :
Following class throws NPE -- should not.
package experimental;
import java.awt.Font;
import javax.swing.DebugGraphics;
public class DebugGraphicsNullPointer {
private DebugGraphics dgraph;
private Font font;
public DebugGraphicsNullPointer() {
}
public static void main(String[] args) {
DebugGraphicsNullPointer pointer = new DebugGraphicsNullPointer();
pointer.runTest();
}
private void runTest() {
dgraph = new DebugGraphics();
font = new Font("Currier", Font.PLAIN, 10);
if(font == null) {
System.out.println("The font object is null"); // does not execute
}
dgraph.setFont(font); // this line throws NPE @ DebugGraphics line 185
}
}
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
run the class
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
should run clean or output the text
ACTUAL -
throws NPE
ERROR MESSAGES/STACK TRACES THAT OCCUR :
Compiling 1 source file to /programs/Infosys/client/build/classes
compile-single:
run-single:
Exception in thread "main" java.lang.NullPointerException
at javax.swing.DebugGraphics.setFont(DebugGraphics.java:185)
at experimental.DebugGraphicsNullPointer.runTest(DebugGraphicsNullPointer.java:43)
at experimental.DebugGraphicsNullPointer.main(DebugGraphicsNullPointer.java:33)
Java Result: 1
BUILD SUCCESSFUL (total time: 10 seconds)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package experimental;
import java.awt.Font;
import javax.swing.DebugGraphics;
/**
*
* @author chuck
*/
public class DebugGraphicsNullPointer {
private DebugGraphics dgraph;
private Font font;
/** Creates a new instance of DebugGraphicsNullPointer */
public DebugGraphicsNullPointer() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DebugGraphicsNullPointer pointer = new DebugGraphicsNullPointer();
pointer.runTest();
}
private void runTest() {
dgraph = new DebugGraphics();
font = new Font("Currier", Font.PLAIN, 10);
if(font == null) {
System.out.println("The font object is null");
}
dgraph.setFont(font);
}
}
---------- END SOURCE ----------
- csr for
-
JDK-8291634 DebugGraphics NPE @ setFont();
- Closed