Skip to content

Commit ec3b646

Browse files
committed
8373239: Test java/awt/print/PrinterJob/PageRanges.java fails with incorrect selection of printed pages
Backport-of: 8723275b9c73cf55a20b3b46153e0353f7e0e41f
1 parent 6f8f250 commit ec3b646

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/java.desktop/windows/classes/sun/awt/windows/WPrinterJob.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1743,6 +1743,10 @@ private void setRangeCopiesAttribute(int from, int to, boolean isRangeSet,
17431743
if (isRangeSet) {
17441744
attributes.add(new PageRanges(from, to));
17451745
setPageRange(from, to);
1746+
} else {
1747+
attributes.remove(PageRanges.class);
1748+
setPageRange(Pageable.UNKNOWN_NUMBER_OF_PAGES,
1749+
Pageable.UNKNOWN_NUMBER_OF_PAGES);
17461750
}
17471751
defaultCopies = false;
17481752
attributes.add(new Copies(copies));

test/jdk/java/awt/print/PrinterJob/PageRanges.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
/**
2525
* @test
26-
* @bug 6575331 8297191
26+
* @bug 6575331 8297191 8373239
2727
* @key printer
2828
* @summary The specified pages should be printed.
2929
* @run main/manual=yesno PageRanges

0 commit comments

Comments
 (0)