-
Bug
-
Resolution: Fixed
-
P2
-
6u2
-
b50
-
other
-
generic
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2170348 | 6u12 | Kevin Walls | P2 | Resolved | Fixed | b02 |
JDK-2167762 | 6u7-rev | Kevin Walls | P3 | Resolved | Fixed | b14 |
JDK-2191147 | 5.0-pool | Karunakar Gajjala | P4 | Closed | Won't Fix |
All
FULL JDK VERSION(S):
java version "1.6.0_02"
Java(TM) SE Runtime Environment (build 1.6.0_02-b06)
Java HotSpot(TM) Client VM (build 1.6.0_02-b06, mixed mode)
DESCRIPTION:
When JDK 6 is used for unzipping a zip file > 2GB in size, the following exception is thrown:
java.util.zip.ZipException: error in opening zip file
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:114)
at java.util.zip.ZipFile.<init>(ZipFile.java:75)
at UnZip.main(UnZip.java:65)
Exact steps to reproduce
1. Create a zip file > 2GB in size.
2. Write a simple java program to unzip the file using a Java program
The following testcase was obtained from another sun bug:
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class unzip
{
public static final void copyInputStream (InputStream in,OutputStream out) throws IOException
{
byte[] buffer = new byte [1024];
int len;
while ((len = in.read(buffer)) >= 0)
out.write(buffer, 0, len);
in.close();
out.close();
}
public static final void main (String[] args)
{
Enumeration entries;
ZipFile zipFile=null;
if (args.length != 1){
System.err.println("Usage: Unzip zipfile");
return;
}
try{
zipFile = new ZipFile(args[0]);
}catch(IOException ioe){System.out.println("error opening the zipfile");ioe.printStackTrace();}
ZipEntry entry=null;
entries = zipFile.entries();
while (entries.hasMoreElements()){
System.out.println("Constructing ZipFile...");
entry = ( ZipEntry ) entries.nextElement();
}
if (entry.isDirectory()){
// Assume directories are stored parents first then children
System.err.println("Extracting directory: " + entry.getName());
// This is not robust, just for demonstration purposes.
(new File(entry.getName())).mkdir();
//continue;
}
System.err.println("Extracting file: " + entry.getName());
try{
copyInputStream(zipFile.getInputStream(entry),new BufferedOutputStream(new FileOutputStream(entry.getName())));
System.out.print("Check memory usage and press 'Enter'...");
System.in.read();
zipFile.close();
}catch(IOException ioe){ioe.printStackTrace();}
}
}
- backported by
-
JDK-2170348 Unable to open zip files more than 2GB in size
- Resolved
-
JDK-2167762 Unable to open zip files more than 2GB in size
- Resolved
-
JDK-2191147 Unable to open zip files more than 2GB in size
- Closed
- relates to
-
JDK-5092263 GZIPInputStream spuriously reports "Corrupt GZIP trailer" for sizes > 2GB
- Resolved
-
JDK-4262583 GZIPInputStream throws IOException for very large files
- Resolved
-
JDK-4418997 Files between 2 Gb and 4Gb (excluded) are not accepted in a zip file.
- Resolved
-
JDK-4795136 CRC check fails for files over 2 GB
- Resolved
-
JDK-6860950 Unable to READ zip files more than 2GB in size
- Closed