factoryexception.java

来自「一个jsp网页布局框架」· Java 代码 · 共 79 行

JAVA
79
字号
/* * Title:        FactoryException * Description: * * This software is published under the terms of the OpenSymphony Software * License version 1.1, of which a copy has been included with this * distribution in the LICENSE.txt file. */package com.opensymphony.module.sitemesh.factory;import java.io.PrintStream;import java.io.PrintWriter;/** * This RuntimeException is thrown by the Factory if it cannot initialize or perform * an appropriate function. * * @author <a href="mailto:joe@truemesh.com">Joe Walnes</a> * @version $Revision: 1.1 $ */public class FactoryException extends RuntimeException {	protected Exception exception = null;	public FactoryException() {		super();	}	public FactoryException(String msg) {		super(msg);	}	public FactoryException(Exception e) {		super();		exception = e;	}	public FactoryException(String msg, Exception e) {		super(msg + ": " + e);		exception = e;	}	/**	 * Get the original cause of the Exception. Returns null if not known.	 */	public Exception getRootCause() {		return exception;	}    public void printStackTrace() {  	    super.printStackTrace();      	if (exception != null) {            synchronized (System.err) {    	        System.err.println("\nRoot cause:");    		    exception.printStackTrace();       	    }	   	}    }    public void printStackTrace(PrintStream s) {        super.printStackTrace(s);      	if (exception != null) {            synchronized (s) {      	        s.println("\nRoot cause:");        		exception.printStackTrace(s);            }        }    }	public void printStackTrace(PrintWriter s) {  	    super.printStackTrace(s);        if (exception != null) {		    synchronized (s) {          	    s.println("\nRoot cause:");        		exception.printStackTrace(s);            }		}    }}

⌨️ 快捷键说明

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