langtools/test/tools/javap/T6715767.java
author katleman
Thu, 21 Aug 2014 14:16:14 -0700
changeset 25878 6d561031123e
parent 5520 86e4b9a9da40
child 30730 d3ce7619db2c
permissions -rw-r--r--
Added tag jdk9-b27 for changeset 98ce0879ab4c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
733
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 733
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
733
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     4
 *
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     8
 *
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    13
 * accompanied this code).
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    14
 *
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 733
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 733
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 733
diff changeset
    21
 * questions.
733
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    22
 */
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    23
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    24
/*
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    25
 * @test
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    26
 * @bug 6715767
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    27
 * @summary javap on java.lang.ClassLoader crashes
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    28
 */
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    29
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    30
import java.io.*;
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    31
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    32
public class T6715767 {
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    33
    public static void main(String... args) throws Exception {
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    34
        new T6715767().run();
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    35
    }
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    36
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    37
    void run() throws Exception {
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    38
        StringWriter sw = new StringWriter();
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    39
        PrintWriter pw = new PrintWriter(sw);
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    40
        String[] args = { "java.lang.ClassLoader" };
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    41
        int rc = com.sun.tools.javap.Main.run(args, pw);
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    42
        if (rc != 0 ||
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    43
            sw.toString().indexOf("at com.sun.tools.javap.JavapTask.run") != -1) {
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    44
            System.err.println("rc: " + rc);
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    45
            System.err.println("log:\n" + sw);
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    46
            throw new Exception("unexpected result");
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    47
        }
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    48
    }
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    49
}
b76c4357c649 6715767: javap on java.lang.ClassLoader crashes
jjg
parents:
diff changeset
    50