chainedruntimeexception.java

来自「一个java工作流引擎」· Java 代码 · 共 53 行

JAVA
53
字号
package org.jbpm.util.lang;

import java.io.*;

public class ChainedRuntimeException  extends RuntimeException {
	
	private Throwable cause = null;

	public ChainedRuntimeException() {
		super();
	}

	public ChainedRuntimeException(String msg) {
		super(msg);
	}
  
	public ChainedRuntimeException(Throwable cause) {
		super(cause.getMessage());
		this.cause = cause;
	}
  
	public ChainedRuntimeException(String msg, Throwable cause) {
    super(msg);
    this.cause = cause;
	}
	
	public Throwable getCause() {
		return cause;
	}

	public void printStackTrace() {
		super.printStackTrace();
		if (cause != null) {
			System.err.println("caused by: " + cause);
		}
	}

	public void printStackTrace(PrintStream s) {
		super.printStackTrace(s);
		if (cause != null) {
			s.println("caused by: ");
			cause.printStackTrace(s);
		}
	}

	public void printStackTrace(PrintWriter s) {
		super.printStackTrace(s);
		if (cause != null) {
			s.println("caused by: ");
			cause.printStackTrace(s);
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?