jdk/test/java/util/zip/DataDescriptorSignatureMissing.java
author martin
Fri, 29 Aug 2014 12:07:11 -0700
changeset 26615 faabac3002f1
permissions -rw-r--r--
8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing Summary: fix off-by-one bug in EXTSIG handling; add docs. Reviewed-by: sherman, alanb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
26615
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     1
/*
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     2
 * Copyright 2012 Google, Inc.  All Rights Reserved.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     4
 *
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     7
 * published by the Free Software Foundation.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     8
 *
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    13
 * accompanied this code).
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    14
 *
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    18
 *
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    21
 * questions.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    22
 */
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    23
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    24
/**
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    25
 * @test
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    26
 * @bug 8056934
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    27
 * @summary Check ability to read zip files created by python zipfile
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    28
 * implementation, which fails to write optional (but recommended) data
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    29
 * descriptor signatures.  Repro scenario is a Java -> Python -> Java round trip:
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    30
 * - ZipOutputStream creates zip file with DEFLATED entries and data
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    31
 *   descriptors with optional signature "PK0x0708".
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    32
 * - Python reads those entries, preserving the 0x08 flag byte
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    33
 * - Python outputs those entries with data descriptors lacking the
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    34
 *   optional signature.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    35
 * - ZipInputStream cannot handle the missing signature
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    36
 *
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    37
 * No way to adapt the technique in this test to get a ZIP64 zip file
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    38
 * without data descriptors was found.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    39
 *
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    40
 * @ignore This test has brittle dependencies on an external working python.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    41
 */
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    42
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    43
import java.io.*;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    44
import java.util.zip.*;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    45
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    46
public class DataDescriptorSignatureMissing  {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    47
    void printStream(InputStream is) throws IOException {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    48
        Reader r = new InputStreamReader(is);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    49
        StringBuilder sb = new StringBuilder();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    50
        char[] buf = new char[1024];
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    51
        int n;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    52
        while ((n = r.read(buf)) > 0) {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    53
            sb.append(buf, 0, n);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    54
        }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    55
        System.out.print(sb);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    56
    }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    57
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    58
    int entryCount(File zipFile) throws IOException {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    59
        try (FileInputStream fis = new FileInputStream(zipFile);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    60
             ZipInputStream zis = new ZipInputStream(fis)) {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    61
            for (int count = 0;; count++)
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    62
                if (zis.getNextEntry() == null)
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    63
                    return count;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    64
        }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    65
    }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    66
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    67
    void test(String[] args) throws Throwable {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    68
        if (! new File("/usr/bin/python").canExecute())
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    69
            return;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    70
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    71
        // Create a java zip file with DEFLATED entries and data
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    72
        // descriptors with signatures.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    73
        final File in = new File("in.zip");
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    74
        final File out = new File("out.zip");
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    75
        final int count = 3;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    76
        try (FileOutputStream fos = new FileOutputStream(in);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    77
             ZipOutputStream zos = new ZipOutputStream(fos)) {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    78
            for (int i = 0; i < count; i++) {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    79
                ZipEntry ze = new ZipEntry("hello.python" + i);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    80
                ze.setMethod(ZipEntry.DEFLATED);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    81
                zos.putNextEntry(ze);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    82
                zos.write(new byte[10]);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    83
                zos.closeEntry();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    84
            }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    85
        }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    86
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    87
        // Copy the zip file using python's zipfile module
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    88
        String[] python_program_lines = {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    89
            "import os",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    90
            "import zipfile",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    91
            "input_zip = zipfile.ZipFile('in.zip', mode='r')",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    92
            "output_zip = zipfile.ZipFile('out.zip', mode='w')",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    93
            "count08 = 0",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    94
            "for input_info in input_zip.infolist():",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    95
            "  output_info = input_info",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    96
            "  if output_info.flag_bits & 0x08 == 0x08:",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    97
            "    count08 += 1",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    98
            "  output_zip.writestr(output_info, input_zip.read(input_info))",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
    99
            "output_zip.close()",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   100
            "if count08 == 0:",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   101
            "  raise ValueError('Expected to see entries with 0x08 flag_bits set')",
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   102
        };
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   103
        StringBuilder python_program_builder = new StringBuilder();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   104
        for (String line : python_program_lines)
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   105
            python_program_builder.append(line).append('\n');
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   106
        String python_program = python_program_builder.toString();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   107
        String[] cmdline = { "/usr/bin/python", "-c", python_program };
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   108
        ProcessBuilder pb = new ProcessBuilder(cmdline);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   109
        pb.redirectErrorStream(true);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   110
        Process p = pb.start();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   111
        printStream(p.getInputStream());
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   112
        p.waitFor();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   113
        equal(p.exitValue(), 0);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   114
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   115
        File pythonZipFile = new File("out.zip");
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   116
        check(pythonZipFile.exists());
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   117
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   118
        equal(entryCount(in),
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   119
              entryCount(out));
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   120
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   121
        // We expect out to be identical to in, except for the removal of
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   122
        // the optional data descriptor signatures.
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   123
        final int SIG_LENGTH = 4;       // length of a zip signature - PKxx
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   124
        equal(in.length(),
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   125
              out.length() + SIG_LENGTH * count);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   126
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   127
        in.delete();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   128
        out.delete();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   129
    }
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   130
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   131
    //--------------------- Infrastructure ---------------------------
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   132
    volatile int passed = 0, failed = 0;
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   133
    void pass() {passed++;}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   134
    void fail() {failed++; Thread.dumpStack();}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   135
    void fail(String msg) {System.err.println(msg); fail();}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   136
    void unexpected(Throwable t) {failed++; t.printStackTrace();}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   137
    void check(boolean cond) {if (cond) pass(); else fail();}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   138
    void equal(Object x, Object y) {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   139
        if (x == null ? y == null : x.equals(y)) pass();
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   140
        else fail(x + " not equal to " + y);}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   141
    public static void main(String[] args) throws Throwable {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   142
        new DataDescriptorSignatureMissing().instanceMain(args);}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   143
    public void instanceMain(String[] args) throws Throwable {
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   144
        try {test(args);} catch (Throwable t) {unexpected(t);}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   145
        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   146
        if (failed > 0) throw new AssertionError("Some tests failed");}
faabac3002f1 8056934: ZipInputStream does not correctly handle local header data descriptors with the optional signature missing
martin
parents:
diff changeset
   147
}