Warnings Cleanup in java.util. (more from hack day) (original) (raw)

Michael Barker mikeb01 at gmail.com
Fri Dec 2 12:02:22 PST 2011


one change to Manifest.java introduces a bug !

-                byte[] vb = value.getBytes("UTF8"); -                value = new String(vb, 0, 0, vb.length); +                byte[] vb = value.getBytes(StandardCharsets.UTF8); +                value = new String(vb, 0, 0, StandardCharsets.UTF8);

the last line should be: value = new String(vb, 0, 0, vb.length);

Cheers, good spot. I've attached an updated patch.

Mike. -------------- next part -------------- diff -r 43a630f11af6 src/share/classes/java/util/jar/Manifest.java --- a/src/share/classes/java/util/jar/Manifest.java Wed Nov 30 13:11:16 2011 -0800 +++ b/src/share/classes/java/util/jar/Manifest.java Fri Dec 02 19:59:38 2011 +0000 @@ -30,6 +30,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.HashMap; import java.util.Iterator; @@ -51,7 +52,7 @@ private Attributes attr = new Attributes();

 // manifest entries

@@ -148,20 +149,20 @@ // Write out the main attributes for the manifest attr.writeMain(dos); // Now write out the pre-entry attributes



More information about the jdk8-dev mailing list