6372077: JarFile.getManifest() should handle manifest attribute name 70 bytes

Reviewed-by: alanb, sherman
This commit is contained in:
Philipp Kunz 2018-03-01 15:50:26 -05:00 committed by Roger Riggs
parent 3a03cd060f
commit 5db337db24
4 changed files with 298 additions and 14 deletions

View file

@ -40,7 +40,9 @@ import sun.util.logging.PlatformLogger;
* The Attributes class maps Manifest attribute names to associated string
* values. Valid attribute names are case-insensitive, are restricted to
* the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70
* characters in length. Attribute values can contain any characters and
* characters in length. There must be a colon and a SPACE after the name;
* the combined length will not exceed 72 characters.
* Attribute values can contain any characters and
* will be UTF8-encoded when written to the output stream. See the
* <a href="{@docRoot}/../specs/jar/jar.html">JAR File Specification</a>
* for more information about valid attribute names and values.
@ -310,8 +312,8 @@ public class Attributes implements Map<Object,Object>, Cloneable {
}
buffer.append(value);
buffer.append("\r\n");
Manifest.make72Safe(buffer);
buffer.append("\r\n");
os.writeBytes(buffer.toString());
}
os.writeBytes("\r\n");
@ -355,8 +357,8 @@ public class Attributes implements Map<Object,Object>, Cloneable {
}
buffer.append(value);
buffer.append("\r\n");
Manifest.make72Safe(buffer);
buffer.append("\r\n");
out.writeBytes(buffer.toString());
}
}