/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/**
* @test
* @bug 4407397
* @summary Test the requesting of exception events
*
* @author Robert Field
*
* @library scaffold
* @run build TestScaffold VMConnection
* @run compile -g ExceptionEvents.java
*
*/
class StackOverflowCaughtTarg {
try {
throw new StackOverflowError();
// ignore
}
}
}
class StackOverflowUncaughtTarg {
thrower();
}
static void thrower() {
throw new StackOverflowError();
}
}
class StackOverflowIndirectTarg {
try {
thrower();
}
}
static void thrower() {
throw new StackOverflowError();
}
}
final boolean caught;
final boolean uncaught;
final int suspendPolicy;
int suspendPolicy) {
super(flags);
this.exceptionName = exceptionName;
this.suspendPolicy = suspendPolicy;
}
}
throw new IllegalArgumentException("see usage");
}
} else {
}
}
everything();
case 'a':
break;
case 't':
break;
case 'n':
break;
default:
usage();
}
}
case 'c':
break;
case 'u':
break;
case 'n':
break;
default:
usage();
}
} else {
usage();
}
}
// final analyse
}
}
}
if (failureCount > 0) {
failureCount + " tests!");
} else {
}
}
/**
* Target throws caught exception.
* Events if caught enabled.
*/
true, true);
true, false);
false, true);
false, false);
}
/**
* Target throws uncaught exception.
* Events if uncaught enabled.
*/
true, true);
false, true);
true, false);
false, false);
}
/**
* Target doesn't throw named exception. No events.
*/
true, true);
false, true);
true, false);
false, false);
}
/**
* Suspend policy should make no difference.
* Iterate over all of them.
*/
boolean expectedEvent,
if (globalSuspendPolicy != -1) {
} else {
}
}
boolean expectedEvent,
int suspendPolicy) throws Exception {
"/caught=" + caught +
"/uncaught=" + uncaught +
" suspend=";
switch (suspendPolicy) {
case EventRequest.SUSPEND_ALL:
description += "All";
break;
description += "Thread";
break;
case EventRequest.SUSPEND_NONE:
description += "None";
break;
default:
throw new Exception("Test failure: bad suspend policy - " +
}
description += "\n";
aRun.startTests();
}
if (expectedEvent) {
if (eventCount == 1) {
println("pass: got expected event");
} else if (eventCount > 1) {
failure("FAILURE: expected only one event got: " +
++failureCount;
} else {
failure("FAILURE: expected event not sent");
++failureCount;
}
} else {
if (eventCount > 0) {
failure("FAILURE: unexpected event sent");
++failureCount;
} else {
println("pass: as expected no event sent");
}
}
}
/********** event handlers **********/
try {
} catch (VMDisconnectedException exc) {
}
eventCount++;
} else {
try {
} catch (VMDisconnectedException exc) {
}
}
}
/**
* Turn off default Exception Handling
*/
protected void createDefaultExceptionRequest() {
}
/********** test core **********/
/*
* Get to the top of main()
*/
if (exceptionName == null) {
} else {
if (exceptionName == null) {
throw new Exception("test failure - cannot find: " +
}
}
}
}