[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: java.util and vm/ref patch
From: |
Mark Wielaard |
Subject: |
Re: java.util and vm/ref patch |
Date: |
25 Mar 2002 21:51:32 +0100 |
Hi,
--- java/util/jar/Manifest.java Mon Dec 3 14:53:26 2001
+++ ../classpath/java/util/jar/Manifest.java Wed Mar 20 18:09:04 2002
@@ -163,7 +163,8 @@
private static void read_main_section(Attributes attr,
BufferedReader br) throws IOException
{
- read_version_info(attr, br);
+ // version info isn't mandatory at the beginning in jar spec.
+ // read_version_info(attr, br);
read_attributes(attr, br);
}
Actually according to (both the old and new) spec the first Main
attribute must be the Manifest-Version and it is mandatory. Which tool
creates Manifest files that do not follow this?
http://docs.iplanet.com/docs/manuals/signedobj/jarfile/jar.htm#426027
http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Manifest%20Specification
But it probably cannot hurt to accept such faulty Manifest files.
I have checked in the following:
2002-03-25 Mark Wielaard <address@hidden>
* java/util/jar/Attributes.java (putValue(Name,String)): Make package
private.
* java/util/Manifest.java (read_main_section): Don't require
Manifest-Version info, set to "0.0" when not found.
Cheers,
Mark
Index: java/util/jar/Attributes.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/jar/Attributes.java,v
retrieving revision 1.6
diff -u -r1.6 Attributes.java
--- java/util/jar/Attributes.java 22 Jan 2002 22:27:01 -0000 1.6
+++ java/util/jar/Attributes.java 25 Mar 2002 20:49:24 -0000
@@ -430,7 +430,7 @@
* @returns the old value of the attribute name or null if it didn't exist
* yet
*/
- private String putValue(Name name, String value)
+ String putValue(Name name, String value)
{
return (String) put(name, value);
}
Index: java/util/jar/Manifest.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/util/jar/Manifest.java,v
retrieving revision 1.6
diff -u -r1.6 Manifest.java
--- java/util/jar/Manifest.java 22 Jan 2002 22:27:01 -0000 1.6
+++ java/util/jar/Manifest.java 25 Mar 2002 20:49:24 -0000
@@ -174,10 +174,19 @@
private static void read_main_section(Attributes attr,
BufferedReader br) throws IOException
{
- read_version_info(attr, br);
+ // According to the spec we should actually call read_version_info() here.
read_attributes(attr, br);
+ // Explicitly set Manifest-Version attribute if not set in Main
+ // attributes of Manifest.
+ if (attr.getValue(Attributes.Name.MANIFEST_VERSION) == null)
+ attr.putValue(Attributes.Name.MANIFEST_VERSION, "0.0");
}
+ /**
+ * Pedantic method that requires the next attribute in the Manifest to be
+ * the "Manifest-Version". This follows the Manifest spec closely but
+ * reject some jar Manifest files out in the wild.
+ */
private static void read_version_info(Attributes attr,
BufferedReader br) throws IOException
{
@@ -185,7 +194,7 @@
try
{
String value = expect_header(version_header, br);
- attr.putValue(version_header, value);
+ attr.putValue(Attributes.Name.MANIFEST_VERSION, value);
}
catch (IOException ioe)
{