|
What this is
This file is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn
Java by Example" TM.
Other links
The source code
/*
* Sun Public License Notice
*
* The contents of this file are subject to the Sun Public License
* Version 1.0 (the "License"). You may not use this file except in
* compliance with the License. A copy of the License is available at
* http://www.sun.com/
*
* The Original Code is NetBeans. The Initial Developer of the Original
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2001 Sun
* Microsystems, Inc. All Rights Reserved.
*/
package breakpoints.conditional;
/**
* The class debugged by ConditionalExceptionBreakpointCommon .
*
* @author Jan Stola
*/
public class ConditionalExceptionBreakpointClass extends Object {
public static char type;
public static class NullPointerException extends Exception {}
public static class ArithmeticException extends RuntimeException {}
public static class ClassNotFoundException extends RuntimeException {}
public static class IllegalArgumentException extends Exception {}
public static class ArrayIndexOutOfBoundsException extends SomeException {}
public static class SomeException extends Exception {}
private static void throwException(Exception e) throws Exception {
throw e;
}
public static void main(String[] args) {
type='n';
System.out.println(type);
try {
throwException(new NullPointerException());
} catch (Exception e) {
}
type='a';
System.out.println(type);
try {
throwException(new ArithmeticException());
} catch (Exception e) {
}
type='A';
System.out.println(type);
try {
throwException(new ArithmeticException());
} catch (Exception e) {
}
type='c';
System.out.println(type);
try {
throwException(new ClassNotFoundException());
} catch (Exception e) {
}
type='i';
System.out.println(type);
try {
throwException(new IllegalArgumentException());
} catch (Exception e) {
}
type='I';
System.out.println(type);
try {
throwException(new IllegalArgumentException());
} catch (Exception e) {
}
type='y';
System.out.println(type);
try {
throwException(new IllegalArgumentException());
} catch (Exception e) {
}
type='Y';
System.out.println(type);
try {
throwException(new IllegalArgumentException());
} catch (Exception e) {
}
type='r';
System.out.println(type);
try {
throwException(new ArrayIndexOutOfBoundsException());
} catch (Exception e) {
}
type='s';
System.out.println(type);
try {
throwException(new SomeException());
} catch (Exception e) {
}
System.exit(0);
}
}
|