-
Bug
-
Resolution: Duplicate
-
P2
-
None
-
6u2
-
x86
-
windows_xp
OPERATING SYSTEM(S):
Windows XP
FULL JDK VERSION(S):
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b04)
Java HotSpot(TM) Client VM (build 1.6.0_01-b04, mixed mode)
DESCRIPTION:
On executing the below Test case (ManifestTest.java) using the manifest file MANIFEST.MF we could see the following output
[Eclipse-AutoStart, Manifest-Version, Bundle-Localization, Bundle-Name, Copyright, Require-Bundle, DynamicImport-Package, Bundle-Vendor, Bundle-Version, SCCSID, Bundle-Activator, Bundle-ManifestVersion, J2EE-DeploymentFactory-Implementation-Class, Import-Package, Bundle-SymbolicName, Eclipse-RegisterBuddy]
The issue found here is that the "Export-Package" attribute, which is present in the manifest file, does not appear in the above list.
Testcase:
---------
import java.io.*;
import java.util.jar.*;
public class ManifestTest {
public static void main(String args[])
{
try {
FileInputStream fis = new FileInputStream(args[0]);
Manifest mf = new Manifest(fis);
System.out.println(mf.getMainAttributes().keySet());
} catch (Exception e) {
}
}
}
Steps to reproduce:
Compile and run ManifestTest.java:
java ManifestTest [manifest file]
The manifest file we used to reproduce the problem can be downloaded from here:
ftp://ftp.emea.ibm.com/fromibm/other/MANIFEST.MF
Analysis:
In Attributes.java ,there is function called
read(Manifest.FastInputStream is, byte[] lbuf)
which parses the attribute-value pair and puts in the table.The issue is when it continues to parse and reaches the last line of the last attribute.It collects the last line but it happens to go into the condition
if (is.peek() == ' ') {}
and then continue with the loop. As there are no more lines to read, it exits the loop, and the last attribute is not captured.
So the fix could be like
if (is.peek() == ' ' && is.available()!=0) {}
which would check for the availability and based on that it may enter the "if" or not.
Windows XP
FULL JDK VERSION(S):
java version "1.6.0_01"
Java(TM) SE Runtime Environment (build 1.6.0_01-b04)
Java HotSpot(TM) Client VM (build 1.6.0_01-b04, mixed mode)
DESCRIPTION:
On executing the below Test case (ManifestTest.java) using the manifest file MANIFEST.MF we could see the following output
[Eclipse-AutoStart, Manifest-Version, Bundle-Localization, Bundle-Name, Copyright, Require-Bundle, DynamicImport-Package, Bundle-Vendor, Bundle-Version, SCCSID, Bundle-Activator, Bundle-ManifestVersion, J2EE-DeploymentFactory-Implementation-Class, Import-Package, Bundle-SymbolicName, Eclipse-RegisterBuddy]
The issue found here is that the "Export-Package" attribute, which is present in the manifest file, does not appear in the above list.
Testcase:
---------
import java.io.*;
import java.util.jar.*;
public class ManifestTest {
public static void main(String args[])
{
try {
FileInputStream fis = new FileInputStream(args[0]);
Manifest mf = new Manifest(fis);
System.out.println(mf.getMainAttributes().keySet());
} catch (Exception e) {
}
}
}
Steps to reproduce:
Compile and run ManifestTest.java:
java ManifestTest [manifest file]
The manifest file we used to reproduce the problem can be downloaded from here:
ftp://ftp.emea.ibm.com/fromibm/other/MANIFEST.MF
Analysis:
In Attributes.java ,there is function called
read(Manifest.FastInputStream is, byte[] lbuf)
which parses the attribute-value pair and puts in the table.The issue is when it continues to parse and reaches the last line of the last attribute.It collects the last line but it happens to go into the condition
if (is.peek() == ' ') {}
and then continue with the loop. As there are no more lines to read, it exits the loop, and the last attribute is not captured.
So the fix could be like
if (is.peek() == ' ' && is.available()!=0) {}
which would check for the availability and based on that it may enter the "if" or not.
- duplicates
-
JDK-4333854 jar skip's last line of manifest file
-
- Closed
-