On Wed, 5 Mar 2025 22:05:51 GMT, Phil Race <p...@openjdk.org> wrote: >> 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 five >> additional commits since the last revision: >> >> - Merge branch 'openjdk:master' into print_options_idx_out_of_rng >> - remove code duplication >> - replace regexp s+ with space >> - use array for option args >> - Fix ArrayIndexOutOfBoundsException at PSPrinterJob printExecCmd > > src/java.desktop/share/classes/sun/print/PSPrinterJob.java line 1579: > >> 1577: if (options != null && !options.isEmpty()) { >> 1578: optionArgs = options.trim().split(" "); >> 1579: ncomps+=optionArgs.length; > > I would have gone for the simpler one line fix of > ncomps+=options.trim().split(" ").length
Done. I tried to avoid using of the `options.trim().split(" ")` twice. > test/jdk/javax/print/PrintExecCmdOptionTest.java line 59: > >> 57: MediaTray mediaTray = null; >> 58: for (PrintService ps : printServices) { >> 59: Media[] medias = (Media[]) ps. > > It looks to me as if this loop needs to reset mediaTray = null. > Otherwise if printer 'N' has a mediaTray, printer 'N+1' will inherit it, even > if it does not have one. Thank you. Fixed. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/23457#discussion_r1987280552 PR Review Comment: https://git.openjdk.org/jdk/pull/23457#discussion_r1987280422