Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/jdk/com/sun/jdi/CatchAllTest.java
41149 views
1
/*
2
* Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation.
8
*
9
* This code is distributed in the hope that it will be useful, but WITHOUT
10
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12
* version 2 for more details (a copy is included in the LICENSE file that
13
* accompanied this code).
14
*
15
* You should have received a copy of the GNU General Public License version
16
* 2 along with this work; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18
*
19
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20
* or visit www.oracle.com if you need additional information or have any
21
* questions.
22
*/
23
24
/*
25
* @test
26
* @bug 4749692
27
* @summary REGRESSION: jdb rejects the syntax catch java.lang.IndexOutOfBoundsException
28
* @comment converted from test/jdk/com/sun/jdi/CatchAllTest.sh
29
*
30
* @library /test/lib
31
* @build CatchAllTest
32
* @run main/othervm CatchAllTest
33
*/
34
35
import jdk.test.lib.process.OutputAnalyzer;
36
import lib.jdb.JdbCommand;
37
import lib.jdb.JdbTest;
38
39
class CatchAllTestTarg {
40
public void bar() {
41
System.out.println("bar"); // @1 breakpoint
42
}
43
44
public static void main(String[] args) {
45
CatchAllTestTarg my = new CatchAllTestTarg();
46
my.bar();
47
}
48
}
49
50
public class CatchAllTest extends JdbTest {
51
public static void main(String argv[]) {
52
new CatchAllTest().run();
53
}
54
55
private CatchAllTest() {
56
super(DEBUGGEE_CLASS);
57
}
58
59
private static final String DEBUGGEE_CLASS = CatchAllTestTarg.class.getName();
60
61
@Override
62
protected void runCases() {
63
setBreakpointsFromTestSource("CatchAllTest.java", 1);
64
// Run to breakpoint #1
65
jdb.command(JdbCommand.run());
66
67
final String IOOB = "java.lang.IndexOutOfBoundsException";
68
jdb.command(JdbCommand.catch_(IOOB));
69
jdb.command(JdbCommand.catch_(""));
70
jdb.command(JdbCommand.ignore(""));
71
jdb.command(JdbCommand.ignore(IOOB));
72
jdb.command(JdbCommand.catch_(JdbCommand.ExType.all, IOOB));
73
jdb.command(JdbCommand.ignore(JdbCommand.ExType.all, IOOB));
74
jdb.command(JdbCommand.catch_(JdbCommand.ExType.caught, IOOB));
75
jdb.command(JdbCommand.ignore(JdbCommand.ExType.caught, IOOB));
76
jdb.command(JdbCommand.catch_(JdbCommand.ExType.uncaught, IOOB));
77
jdb.command(JdbCommand.ignore(JdbCommand.ExType.uncaught, IOOB));
78
79
jdb.contToExit(1);
80
81
new OutputAnalyzer(getJdbOutput())
82
.shouldNotContain("Usage: catch")
83
.shouldNotContain("Usage: ignore");
84
}
85
86
}
87
88