src/share/classes/java/util/jar/Manifest.java

Print this page
rev 4793 : 7117249: java.util warnings patches from LJC/Mike Barker

@@ -49,11 +49,11 @@
 public class Manifest implements Cloneable {
     // manifest main attributes
     private Attributes attr = new Attributes();
 
     // manifest entries
-    private Map entries = new HashMap();
+    private Map<String, Attributes> entries = new HashMap<>();
 
     /**
      * Constructs a new, empty Manifest.
      */
     public Manifest() {

@@ -146,24 +146,24 @@
     public void write(OutputStream out) throws IOException {
         DataOutputStream dos = new DataOutputStream(out);
         // Write out the main attributes for the manifest
         attr.writeMain(dos);
         // Now write out the pre-entry attributes
-        Iterator it = entries.entrySet().iterator();
+        Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
         while (it.hasNext()) {
-            Map.Entry e = (Map.Entry)it.next();
+            Map.Entry<String, Attributes> e = it.next();
             StringBuffer buffer = new StringBuffer("Name: ");
-            String value = (String)e.getKey();
+            String value = e.getKey();
             if (value != null) {
                 byte[] vb = value.getBytes("UTF8");
                 value = new String(vb, 0, 0, vb.length);
             }
             buffer.append(value);
             buffer.append("\r\n");
             make72Safe(buffer);
             dos.writeBytes(buffer.toString());
-            ((Attributes)e.getValue()).write(dos);
+            e.getValue().write(dos);
         }
         dos.flush();
     }
 
     /**