Details
-
Bug
-
Resolution: Fixed
-
P4
-
8, 11, 23
-
b02
Description
The java/awt/print/PrinterJob/PrintNullString.java tests Graphics2D.drawString API which accepts int and float as the coordinates, yet in some cases it passes int where it float should be.
https://github.com/openjdk/jdk/blob/1e04ee6d57d5fe84e1d202b16e8d13dc13c002ff/test/jdk/java/awt/print/PrinterJob/PrintNullString.java#L148-L154
// API 3: null & empty drawString(Iterator, int, int);
try {
g2d.drawString(nullIterator, 20, 120);
g2d.drawString("FAILURE: No NPE for null iterator, float", 20, 120);
} catch (NullPointerException e) {
g2d.drawString("caught expected NPE for null iterator, int", 20, 120);
}
This code has inconsistency: the error message refers to float whereas the call to g2d.drawString uses int and the success message uses int.
https://github.com/openjdk/jdk/blob/1e04ee6d57d5fe84e1d202b16e8d13dc13c002ff/test/jdk/java/awt/print/PrinterJob/PrintNullString.java#L171-L176
try {
g2d.drawString(emptyIterator, 20, 180);
g2d.drawString("FAILURE: No IAE for empty iterator, float", 20, 180);
} catch (IllegalArgumentException e) {
g2d.drawString("caught expected IAE for empty iterator, float", 20, 180);
}
This piece of code should use float coordinates but it still uses int.
https://github.com/openjdk/jdk/blob/1e04ee6d57d5fe84e1d202b16e8d13dc13c002ff/test/jdk/java/awt/print/PrinterJob/PrintNullString.java#L148-L154
// API 3: null & empty drawString(Iterator, int, int);
try {
g2d.drawString(nullIterator, 20, 120);
g2d.drawString("FAILURE: No NPE for null iterator, float", 20, 120);
} catch (NullPointerException e) {
g2d.drawString("caught expected NPE for null iterator, int", 20, 120);
}
This code has inconsistency: the error message refers to float whereas the call to g2d.drawString uses int and the success message uses int.
https://github.com/openjdk/jdk/blob/1e04ee6d57d5fe84e1d202b16e8d13dc13c002ff/test/jdk/java/awt/print/PrinterJob/PrintNullString.java#L171-L176
try {
g2d.drawString(emptyIterator, 20, 180);
g2d.drawString("FAILURE: No IAE for empty iterator, float", 20, 180);
} catch (IllegalArgumentException e) {
g2d.drawString("caught expected IAE for empty iterator, float", 20, 180);
}
This piece of code should use float coordinates but it still uses int.
Attachments
Issue Links
- relates to
-
JDK-8334016 Make PrintNullString.java semi-automatic
- Open
-
JDK-8324808 Manual printer tests have no Pass/Fail buttons, instructions close set 3
- Resolved