< prev index next >

src/java.desktop/unix/classes/sun/print/IPPPrintService.java

Print this page

        

@@ -57,10 +57,11 @@
 import java.io.InputStreamReader;
 import java.nio.charset.Charset;
 
 import java.util.Iterator;
 import java.util.HashSet;
+import java.util.Map;
 
 
 public class IPPPrintService implements PrintService, SunPrinterJobService {
 
     public static final boolean debugPrint;

@@ -1763,10 +1764,23 @@
                 if ((is = urlConnection.getInputStream())!=null) {
                     HashMap<String, AttributeClass>[] responseMap = readIPPResponse(is);
 
                     if (responseMap != null && responseMap.length > 0) {
                         getAttMap = responseMap[0];
+                        // If there is 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<String, AttributeClass> entry : responseMap[i].entrySet()) {
+                                    if (!getAttMap.containsKey(entry.getValue())) {
+                                        getAttMap.put(entry.getKey(), entry.getValue());
+                                    }
+                                }                                
+                            }
+                        }
                     }
                 } else {
                     debug_println(debugPrefix+"opGetAttributes - null input stream");
                 }
                 is.close();
< prev index next >