--- old/src/java.desktop/unix/classes/sun/print/IPPPrintService.java 2017-01-10 14:26:28.516000000 +0530 +++ new/src/java.desktop/unix/classes/sun/print/IPPPrintService.java 2017-01-10 14:26:28.088000000 +0530 @@ -59,6 +59,7 @@ import java.util.Iterator; import java.util.HashSet; +import java.util.Map; public class IPPPrintService implements PrintService, SunPrinterJobService { @@ -1765,6 +1766,19 @@ if (responseMap != null && responseMap.length > 0) { getAttMap = responseMap[0]; + // If there is any extra hashmap created due to duplicate + // key/attribute present in IPPresponse, then use that + // map too by appending to getAttMap after removing the + // duplicate key/value + if (responseMap.length > 1) { + for (int i = 1; i < responseMap.length; i++) { + for (Map.Entry entry : responseMap[i].entrySet()) { + if (!getAttMap.containsKey(entry.getValue())) { + getAttMap.put(entry.getKey(), entry.getValue()); + } + } + } + } } } else { debug_println(debugPrefix+"opGetAttributes - null input stream"); --- old/test/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java 2017-01-10 14:26:29.556000000 +0530 +++ new/test/java/awt/print/PrinterJob/PrintAttributeUpdateTest.java 2017-01-10 14:26:29.160000000 +0530 @@ -23,7 +23,7 @@ /* @test - @bug 8042713 + @bug 8042713 8170578 @summary Print Dialog does not update attribute set with page range @run main/manual PrintAttributeUpdateTest */ @@ -33,6 +33,7 @@ import java.awt.print.Pageable; import java.awt.print.Printable; import java.awt.print.PrinterJob; +import javax.print.PrintService; import javax.print.attribute.Attribute; import javax.print.attribute.HashPrintRequestAttributeSet; import javax.print.attribute.standard.DialogTypeSelection; @@ -43,6 +44,11 @@ public class PrintAttributeUpdateTest implements Pageable, Printable { public static void main(String args[]) throws Exception { + PrintService prtSrv = PrinterJob.getPrinterJob().getPrintService(); + if (prtSrv == null) { + System.out.println("No Printers. Test cannot continue"); + return; + } String[] instructions = { "Select Pages Range From instead of All in print dialog. ",