jdk/test/java/util/jar/JarFile/MevNPE.java
author xuelei
Fri, 29 Jul 2011 02:50:58 -0700
changeset 10138 b7572da25d15
parent 9001 4eb5b77d7425
permissions -rw-r--r--
7068662: Reserve and restore the default locale Reviewed-by: alanb, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9001
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     1
/*
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     2
 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     4
 *
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     7
 * published by the Free Software Foundation.
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     8
 *
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    13
 * accompanied this code).
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    14
 *
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    18
 *
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    21
 * questions.
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    22
 */
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    23
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    24
/* @test
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    25
 * @bug 7023056
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    26
 * @summary NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    27
 */
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    28
import java.io.*;
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    29
import java.util.jar.*;
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    30
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    31
public class MevNPE {
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    32
    public static void main(String[] args) throws Exception {
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    33
        File f = new File(System.getProperty("test.src", "."), "Signed.jar");
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    34
        try (JarFile jf = new JarFile(f, true)) {
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    35
            try (InputStream s1 = jf.getInputStream(
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    36
                    jf.getJarEntry(JarFile.MANIFEST_NAME))) {
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    37
                s1.read(new byte[10000]);
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    38
            };
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    39
            try (InputStream s2 = jf.getInputStream(
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    40
                    jf.getJarEntry(JarFile.MANIFEST_NAME))) {
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    41
                s2.read(new byte[10000]);
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    42
            };
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    43
        }
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    44
    }
4eb5b77d7425 7023056: NPE from sun.security.util.ManifestEntryVerifier.verify during Maven build
weijun
parents:
diff changeset
    45
}