📄 generalfailureexception.java
字号:
package apusic.myshop.control;import java.rmi.RemoteException;import javax.naming.NamingException;import javax.ejb.CreateException;import javax.ejb.EJBException;import java.sql.SQLException;/*** This exception is thrown for all problems that occur in the EJB* Container code of the sample application. This class defines a few* typical error types to help the developer find the error* cause.*/public class GeneralFailureException extends EJBException implements java.io.Serializable { private String cause; public static final String COMM_FAILURE = "RMI/IIOP problem"; public static final String EJB_CREATION_FAILURE = "EJB creation problem"; public static final String JNDI_PROBLEMS = "JNDI problem"; public static final String DB_PROBLEMS = "Database problem"; public GeneralFailureException(String cause) { super(cause); this.cause = cause; } public GeneralFailureException(Exception e) { super(e); if (e instanceof NamingException) { this.cause = JNDI_PROBLEMS; } else if (e instanceof SQLException) { this.cause = DB_PROBLEMS; } else if (e instanceof CreateException) { this.cause = EJB_CREATION_FAILURE; } else if (e instanceof RemoteException) { this.cause = COMM_FAILURE; } else { this.cause = e.toString(); } } public String getCause() { return cause; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -