This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ZipInputStream brokenness


Here's a program that demonstrates the intermittent nature of the problem
(for me at least).  Does anyone else get this behavior?

; cat ZISTestLoop.java
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.net.URL;

public class ZISTestLoop {
    public static void main(String[] args) throws Exception {
        int n = Integer.valueOf(args[0]).intValue();

        URL u = new URL("http://www.xwt.org/dist/xwt-0258.jar";);
        for (int i = 0; i < n; ++i) {
            System.out.print('.');
            try {
                ZipInputStream zis = new ZipInputStream(u.openStream());
                for (ZipEntry ze; (ze = zis.getNextEntry()) != null; ) {
                    // System.out.println(ze.getName());
                }
            } catch (Exception e) {
                System.out.println("\nException on iteration " + i + " " + e);
                // e.printStackTrace();
            }
        }
    }
}


; gcj ZISTestLoop.java --main=ZISTestLoop -o ZISTestLoop
; ./ZISTestLoop 100
..
Exception on iteration 1 java.util.zip.ZipException: Wrong Local header signaturef42283ec
..
Exception on iteration 3 java.util.zip.ZipException: Wrong Local header signaturef42283ec
..
Exception on iteration 5 java.util.zip.ZipException: Wrong Local header signaturef42283ec
....
Exception on iteration 9 java.util.zip.ZipException: Wrong Local header signaturef42283ec
.
Exception on iteration 10 java.util.zip.ZipException: Wrong Local header signaturef42283ec
..
Exception on iteration 12 java.util.zip.ZipException: Wrong Local header signaturef42283ec
.
Exception on iteration 13 java.util.zip.ZipException: Wrong Local header signaturef42283ec
..
Exception on iteration 15 java.util.zip.ZipException: Wrong Local header signaturef42283ec
.
Exception on iteration 16 java.util.zip.ZipException: Wrong Local header signaturef42283ec
.
Exception on iteration 17 java.util.zip.ZipException: Wrong Local header signaturef42283ec
..
Exception on iteration 19 java.util.zip.ZipException: Wrong Local header signaturef42283ec
.
Exception on iteration 20 java.util.zip.ZipException: Wrong Local header signaturef42283ec
....
[output continues]


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]