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

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

*** 49,59 **** public class Manifest implements Cloneable { // manifest main attributes private Attributes attr = new Attributes(); // manifest entries ! private Map entries = new HashMap(); /** * Constructs a new, empty Manifest. */ public Manifest() { --- 49,59 ---- public class Manifest implements Cloneable { // manifest main attributes private Attributes attr = new Attributes(); // manifest entries ! private Map<String, Attributes> entries = new HashMap<>(); /** * Constructs a new, empty Manifest. */ public Manifest() {
*** 146,169 **** 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(); while (it.hasNext()) { ! Map.Entry e = (Map.Entry)it.next(); StringBuffer buffer = new StringBuffer("Name: "); ! String value = (String)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); } dos.flush(); } /** --- 146,169 ---- 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<Map.Entry<String, Attributes>> it = entries.entrySet().iterator(); while (it.hasNext()) { ! Map.Entry<String, Attributes> e = it.next(); StringBuffer buffer = new StringBuffer("Name: "); ! 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()); ! e.getValue().write(dos); } dos.flush(); } /**