Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions test/jdk/java/awt/print/PrinterJob/PrintNullString.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 2026, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -37,7 +37,7 @@

/*
* @test
* @bug 4223328
* @bug 4223328 4138921
* @summary Printer graphics must throw expected exceptions
* @key printer
* @run main PrintNullString
Expand Down Expand Up @@ -106,12 +106,8 @@ public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
g2d.drawString("caught expected NPE for null iterator, int", 20, 120);
}

try {
g2d.drawString(emptyIterator, 20, 140);
throw new RuntimeException("FAILURE: No IAE for empty iterator, int");
} catch (IllegalArgumentException e) {
g2d.drawString("caught expected IAE for empty iterator, int", 20, 140);
}
g2d.drawString(emptyIterator, 20, 140);
g2d.drawString("OK for empty iterator, int", 20, 140);

// API 4: null & empty drawString(Iterator, float, int);
try {
Expand All @@ -121,12 +117,8 @@ public int print(Graphics g, PageFormat pgFmt, int pgIndex) {
g2d.drawString("caught expected NPE for null iterator, float", 20, 160);
}

try {
g2d.drawString(emptyIterator, 20.0f, 180.0f);
throw new RuntimeException("FAILURE: No IAE for empty iterator, float");
} catch (IllegalArgumentException e) {
g2d.drawString("caught expected IAE for empty iterator, float", 20, 180);
}
g2d.drawString(emptyIterator, 20.0f, 180.0f);
g2d.drawString("OK for empty iterator, float", 20.0f, 100.f);

return PAGE_EXISTS;
}
Expand Down