Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/test/com/sun/jdi/CatchPatternTest.sh
38855 views
1
#!/bin/sh
2
3
#
4
# Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
5
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6
#
7
# This code is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License version 2 only, as
9
# published by the Free Software Foundation.
10
#
11
# This code is distributed in the hope that it will be useful, but WITHOUT
12
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
# version 2 for more details (a copy is included in the LICENSE file that
15
# accompanied this code).
16
#
17
# You should have received a copy of the GNU General Public License version
18
# 2 along with this work; if not, write to the Free Software Foundation,
19
# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
#
21
# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
# or visit www.oracle.com if you need additional information or have any
23
# questions.
24
#
25
26
# @test
27
# @bug 4671838
28
# @summary TTY: surprising ExceptionSpec.resolveEventRequest() wildcard results
29
# @author Tim Bell
30
#
31
# @run shell CatchPatternTest.sh
32
classname=CatchPatternTestTarg
33
createJavaFile()
34
{
35
cat <<EOF > $classname.java.1
36
public class $classname {
37
public void bark(int i) {
38
System.out.println(" bark: " + i);
39
switch (i) {
40
case 0:
41
throw new IllegalArgumentException("IllegalArgumentException");
42
case 1:
43
throw new ArithmeticException("ArithmeticException");
44
case 2:
45
throw new IllegalMonitorStateException("IllegalMonitorStateException");
46
case 3:
47
throw new IndexOutOfBoundsException("IndexOutOfBoundsException");
48
default:
49
throw new Error("should not happen");
50
}
51
}
52
public void loop(int max) {
53
for (int i = 0; i <= max; i++) {
54
try {
55
bark(i);
56
} catch(RuntimeException re) {
57
System.out.println(" loop: " + re.getMessage() +
58
" caught and ignored.");
59
}
60
}
61
}
62
public void partOne() {
63
loop(2);
64
System.out.println("partOne completed");
65
}
66
public void partTwo() {
67
loop(3);
68
System.out.println("partTwo completed");
69
}
70
public static void main(String[] args) {
71
System.out.println("Howdy!");
72
$classname my = new $classname();
73
my.partOne();
74
my.partTwo();
75
System.out.println("Goodbye from $classname!");
76
}
77
}
78
EOF
79
}
80
81
# This is called to feed cmds to jdb.
82
dojdbCmds()
83
{
84
#set -x
85
cmd stop in ${classname}.main
86
cmd stop in ${classname}.partTwo
87
runToBkpt
88
cmd ignore uncaught java.lang.Throwable
89
cmd catch all java.lang.I*
90
cmd cont
91
cmd cont
92
cmd cont
93
cmd ignore all java.lang.I*
94
cmd cont
95
cmd quit
96
}
97
98
mysetup()
99
{
100
if [ -z "$TESTSRC" ] ; then
101
TESTSRC=.
102
fi
103
104
for ii in . $TESTSRC $TESTSRC/.. ; do
105
if [ -r "$ii/ShellScaffold.sh" ] ; then
106
. $ii/ShellScaffold.sh
107
break
108
fi
109
done
110
}
111
112
# You could replace this next line with the contents
113
# of ShellScaffold.sh and this script will run just the same.
114
mysetup
115
116
runit
117
#
118
jdbFailIfNotPresent "Exception occurred: java.lang.IllegalArgumentException"
119
jdbFailIfNotPresent "Exception occurred: java.lang.IllegalMonitorStateException"
120
jdbFailIfPresent "Exception occurred: ArithmeticException"
121
jdbFailIfPresent "Exception occurred: IndexOutOfBoundsException"
122
jdbFailIfPresent "Exception occurred: IllegalStateException"
123
jdbFailIfPresent "should not happen"
124
debuggeeFailIfNotPresent "partOne completed"
125
debuggeeFailIfNotPresent "partTwo completed"
126
#
127
pass
128
129