📄 ccexception.java
字号:
/*
* @author : Neelesh
* @Version : 2.0
*
* Development Environment : Oracle9i JDeveloper
* Name of the File : CCException.java
* Creation/Modification History :
*
* Neelesh 04-Apr-2003 Created
*
*/
package oracle.otnsamples.ws;
// Import java IO classes
import java.io.PrintStream;
import java.io.PrintWriter;
/**
* This exception should be thrown by Credit card validation classes, if the
* validation fails.
*
* @author Neelesh
* @version 2.0
*/
public class CCException extends RuntimeException {
private Throwable cause;
/**
* Default Constructor. Takes no arguments
*/
public CCException() {
}
/**
* Constructor
*
* @param <b> message </b> The detailed exception message.
*/
public CCException(String message) {
super(message);
}
/**
* Constructor
*
* @param <b>message</b> The detailed exception message.
* @param <b>thr</b> The Throwable class.
*/
public CCException(final String message, final Throwable thr) {
super(message);
cause = thr;
}
/**
* Constructor
*
* @param <b>thr</b> The Throwable class.
*/
public CCException(final Throwable thr) {
super((thr == null) ? null : thr.getMessage());
}
/**
* getRootCause method returns the Throwable class
*
* @return <b>cause</b> Throwable class
*/
public final Throwable getRootCause() {
return cause;
}
/**
* Override printStackTrace method
*
* @param <b>stream</b> The PrintStream class.
*/
public void printStackTrace(PrintStream stream) {
super.printStackTrace(stream);
if(getRootCause() != null) {
stream.print("The Exception Details are : ");
getRootCause().printStackTrace(stream);
}
}
/**
* Override printStackTrace method
*
* @param <b>writer</b> The PrintWriter class.
*/
public void printStackTrace(PrintWriter writer) {
super.printStackTrace(writer);
if(getRootCause() != null) {
writer.print("The Exception Details are : ");
getRootCause().printStackTrace(writer);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -