harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Zhou (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-6253) [classlib][archive] java.util.jar.JarInputStream.getNextJarEntry() should not throw ZipException
Date Mon, 29 Jun 2009 13:33:47 GMT
[classlib][archive] java.util.jar.JarInputStream.getNextJarEntry() should not throw ZipException
------------------------------------------------------------------------------------------------

                 Key: HARMONY-6253
                 URL: https://issues.apache.org/jira/browse/HARMONY-6253
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
    Affects Versions: 5.0M10
            Reporter: Kevin Zhou
             Fix For: 5.0M11


Given a test case [1], RI passes it smoothly while HARMONY throws a java.util.zip.ZipException
[2].

[1] Test Case:
public void testJarInputStream() throws Exception {
    JarInputStream jarInputStream = new JarInputStream(new FileInputStream("lib/ant.jar"));
    JarOutputStream jarOutputStream = new JarOutputStream(new FileOutputStream("lib/ant.jar.gz"));

    JarEntry jarEntry;
    byte[] bytes = new byte[1024];
    InputStream inputStream = new BufferedInputStream(jarInputStream);
    while ((jarEntry = jarInputStream.getNextJarEntry()) != null) {
        jarOutputStream.putNextEntry(jarEntry);
        int read = -1;
        while ((read = inputStream.read(bytes)) != -1) {
            jarOutputStream.write(bytes, 0, read);
        }
        jarOutputStream.closeEntry();
    }
    jarOutputStream.close();
}

[2] Stack Trace:
java.util.zip.ZipException: Size mismatch
at java.util.zip.ZipInputStream.closeEntry(ZipInputStream.java:138)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:156)
at java.util.jar.JarInputStream.getNextEntry(JarInputStream.java:160)
at java.util.jar.JarInputStream.getNextJarEntry(JarInputStream.java:111)
at Test.testJarInputStream(Test.java:22)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message