RFR: 8343224: print/Dialog/PaperSizeError.java fails with MediaSizeName is not A4: A4 [v6]

GennadiyKrivoshein duke at openjdk.org
Tue Dec 17 08:58:28 UTC 2024


> Fix for https://bugs.openjdk.org/browse/JDK-8343224, print/Dialog/PaperSizeError.java fails with MediaSizeName is not A4: A4.
> 
> **Reason of the bug:**
> The reason for the regression bug is a missed check for the standard media existence during CustomMediaSizeName creation.
> After the JDK-7001133 new MediaSize is created, regardless of whether a standard media size exists. 
> 
> For example, if a printer's PPD has two media with the same size, close to "iso_A4," with a small difference.
>          *PaperDimension A4/A4:             "595 842"
>          *PaperDimension BrA4_B/A4 (Borderless):  "595 842"
> After processing the first line, the MediaSize will contain the new size "A4" because of the missed check, and CustomMediaSize will match the "iso_a4" standard media size.
> After processing the second line, the MediaSize will contain the new size "BrA4_B", and CustomMediaSize will match not the "iso_a4" but the previously added "A4", because it was added by mistake and its size is exactly the same as "BrA4_B".
> 
> **Fix description:**
> Create new MediaSize if there is no any other MediaSize with the same size.
> 
> **Tests:**
> OS: MacOS 12, Linux Ubuntu 22, Windows 11. 
> open/test/jdk/java/awt/print/Dialog/PaperSizeError.java
> test/jdk/javax/print/CustomMediaSizeNameOOMETest.java
> All tests from the test/jdk/javax/print/

GennadiyKrivoshein has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:

 - Merge branch 'openjdk:master' into 8343224-print.Dialog.PaperSizeError.java-fails
 - Update test/jdk/java/awt/print/Dialog/PaperSizeError.java
   
   Add created year to the copyright
   
   Co-authored-by: Aleksandr Zvegintsev <77687766+azvegint at users.noreply.github.com>
 - expand imports
 - update test tag
 - update copyright
 - Create MediaSize only if getStandardMedia is null

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/22429/files
  - new: https://git.openjdk.org/jdk/pull/22429/files/f33d38e4..c9e0d19b

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=22429&range=05
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=22429&range=04-05

  Stats: 110732 lines in 4120 files changed: 84928 ins; 14962 del; 10842 mod
  Patch: https://git.openjdk.org/jdk/pull/22429.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/22429/head:pull/22429

PR: https://git.openjdk.org/jdk/pull/22429


More information about the client-libs-dev mailing list