Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/mobile
Path: blob/master/test/hotspot/jtreg/vmTestbase/nsk/jdi/ExceptionRequest/notifyUncaught/notifyuncaught001a.java
41162 views
1
/*
2
* Copyright (c) 2001, 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
package nsk.jdi.ExceptionRequest.notifyUncaught;
25
26
import nsk.share.*;
27
import nsk.share.jpda.*;
28
import nsk.share.jdi.*;
29
30
/**
31
* This class is used as debuggee application for the notifyuncaught001 JDI test.
32
*/
33
34
public class notifyuncaught001a {
35
36
//----------------------------------------------------- templete section
37
38
static final int PASSED = 0;
39
static final int FAILED = 2;
40
static final int PASS_BASE = 95;
41
42
static ArgumentHandler argHandler;
43
static Log log;
44
45
//-------------------------------------------------- log procedures
46
47
public static void log1(String message) {
48
log.display("**> debuggee: " + message);
49
}
50
51
private static void logErr(String message) {
52
log.complain("**> debuggee: " + message);
53
}
54
55
//====================================================== test program
56
57
static Thread1notifyuncaught001a thread1 = null;
58
59
//------------------------------------------------------ common section
60
61
static int exitCode = PASSED;
62
63
static int instruction = 1;
64
static int end = 0;
65
// static int quit = 0;
66
// static int continue = 2;
67
static int maxInstr = 1; // 2;
68
69
static int lineForComm = 2;
70
71
private static void methodForCommunication() {
72
int i1 = instruction;
73
int i2 = i1;
74
int i3 = i2;
75
}
76
//---------------------------------------------------- main method
77
78
public static void main (String argv[]) {
79
80
argHandler = new ArgumentHandler(argv);
81
log = argHandler.createDebugeeLog();
82
83
log1("debuggee started!");
84
85
86
for (int i = 0; ; i++) {
87
88
89
90
if (instruction > maxInstr) {
91
logErr("ERROR: unexpected instruction: " + instruction);
92
exitCode = FAILED;
93
break ;
94
}
95
96
switch (i) {
97
98
//------------------------------------------------------ section tested
99
100
case 0:
101
thread1 = new Thread1notifyuncaught001a("thread1");
102
log1("new notifyuncaught001a().run1(thread1);");
103
new notifyuncaught001a().run1(thread1);
104
105
//------------------------------------------------- standard end section
106
107
default:
108
instruction = end;
109
break;
110
}
111
log1("methodForCommunication();");
112
methodForCommunication();
113
if (instruction == end)
114
break;
115
}
116
117
log1("debuggee exits");
118
System.exit(exitCode + PASS_BASE);
119
}
120
121
static Object waitnotifyObj = new Object();
122
123
static int threadStart(Thread t) {
124
synchronized (waitnotifyObj) {
125
t.start();
126
try {
127
waitnotifyObj.wait();
128
} catch ( Exception e) {
129
exitCode = FAILED;
130
logErr(" Exception : " + e );
131
return FAILED;
132
}
133
}
134
return PASSED;
135
}
136
137
public void run1(Thread t) {
138
t.start();
139
try {
140
t.join();
141
} catch ( InterruptedException e ) {
142
}
143
}
144
}
145
146
147
class TestClass10{
148
void m10() {
149
throw new NullPointerException("m10");
150
}
151
}
152
class TestClass11 extends TestClass10{
153
void m11() {
154
155
try {
156
(new TestClass10()).m10();
157
} catch ( NullPointerException e ) {
158
}
159
throw new NullPointerException("m11");
160
}
161
}
162
163
class Thread1notifyuncaught001a extends Thread {
164
165
String tName = null;
166
167
public Thread1notifyuncaught001a(String threadName) {
168
super(threadName);
169
tName = threadName;
170
}
171
172
public void run() {
173
notifyuncaught001a.log1(" 'run': enter :: threadName == " + tName);
174
try {
175
(new TestClass11()).m11();
176
} catch ( NullPointerException e) {
177
}
178
notifyuncaught001a.log1(" 'run': exit :: threadName == " + tName);
179
return;
180
}
181
}
182
183