⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jahiaexception.java

📁 java 写的一个新闻发布系统
💻 JAVA
字号:
////                                   ____.//                       __/\ ______|    |__/\.     _______//            __   .____|    |       \   |    +----+       \//    _______|  /--|    |    |    -   \  _    |    :    -   \_________//   \\______: :---|    :    :           |    :    |         \________>//           |__\---\_____________:______:    :____|____:_____\//                                      /_____|////                 . . . i n   j a h i a   w e   t r u s t . . .//////  JahiaException////  EV      31 Oct. 2000//  EV       5 Nov. 2000    added error codes//  FH       8 Jan. 2001    Added some methods : getUserErrorMsg(),//                          getJahiaErrorMsg(), getErrorCode()////  JahiaException//  getSeverity//package org.jahia.exceptions;import org.jahia.utils.*;import java.io.*;           // JahiaConsolepublic class JahiaException extends Exception{    public static final int     WARNING                 =    1;    public static final int     ERROR                   =    2;    public static final int     CRITICAL                =    3;    public static final int     KISS_YOUR_ASS_GOODBYE   =    4;    public static final int     INITIALIZATION_ERROR    =    0;    public static final int     DATABASE_ERROR          =    1;    public static final int     FILE_ERROR              =    2;    public static final int     DATA_ERROR              =    3;    public static final int     TEMPLATE_ERROR          =    4;    /** User error code */    public static final int     USER_ERROR              =    5;    /** Page error code */    public static final int     PAGE_ERROR              =    6;    public static final int     WINDOW_ERROR            =    7;    public static final int     PARAMETER_ERROR         =    8;    public static final int     APPLICATION_ERROR       =    9;    public static final int     NEWSFEED_ERROR          =   10;    public static final int     CONFIG_ERROR            =   11;    public static final int     SERVICE_ERROR           =   12;    public static final int     REGISTRY_ERROR          =   13;    public static final int     SERVLET_ERROR           =   14;    public static final int     LISTENER_ERROR          =   15;    /** Security error code (Access denied) */    public static final int     SECURITY_ERROR          =   16;    /** Access Control List error code */    public static final int     ACL_ERROR               =   17;    public static final int     CACHE_ERROR             =   18;    public static final int     OBJECT_ERROR            =   19;    public static final int     ENGINE_ERROR            =   20;    /** Lock error code */    public static final int     LOCK_ERROR              =   21;    /** Session error code */    public static final int     SESSION_ERROR           =   22;    /** Accounts error code */    protected static final int  ACCOUNTS_ERROR          =   23;    /** License error code */    protected static final int  LICENSE_ERROR           =   24;    /** Jef file error code */    public static final int  JEF_ERROR           		=   25;    /** Java Security ERROR */    public static final int  JAVASECURITY_ERROR     	=   26;    /** Archive File error code **/    public static final int	ENTRY_NOT_FOUND				= 	30;    /** Site not found **/    public static final int	SITE_NOT_FOUND				= 	40;    protected String  mUserErrorMsg;    protected String  mJahiaErrorMsg;    protected int     mErrorCode;    protected int     mErrorSeverity;    protected Throwable mRootCauseException;    //-------------------------------------------------------------------------    /***     * constructor     * EV    31.10.2000     *     */    public JahiaException  (String  userErrorMsg,                            String  jahiaErrorMsg,                            int     errorCode,                            int     errorSeverity)    {        super (userErrorMsg + ", " + jahiaErrorMsg);        mUserErrorMsg   = userErrorMsg;        mJahiaErrorMsg  = jahiaErrorMsg;        mErrorCode      = errorCode;        mErrorSeverity  = errorSeverity;        JahiaConsole.println("JahiaException","EXCEPTION -> " + userErrorMsg + ", " + jahiaErrorMsg);    } // end constructor    /**     * This exception constructor allows us to keep the original exception information     * so that we may display it and access more details about the real cause     * of the exception. Hopefully the need for this will disappear with the     * introduction of exception chaining in JDK 1.4     * @author Serge Huber.     */    public JahiaException  (String  userErrorMsg,                            String  jahiaErrorMsg,                            int     errorCode,                            int     errorSeverity,                            Throwable t)    {        super (userErrorMsg + ", " + jahiaErrorMsg);        mUserErrorMsg   = userErrorMsg;        mJahiaErrorMsg  = jahiaErrorMsg;        mErrorCode      = errorCode;        mErrorSeverity  = errorSeverity;        mRootCauseException = t;        JahiaConsole.println("JahiaException","ROOT CAUSE EXCEPTION -> " + userErrorMsg + "," + jahiaErrorMsg);    }    //-------------------------------------------------------------------------    /***     * getSeverity     * EV    31.10.2000     *     */    public int getSeverity()    {        return mErrorSeverity;    } // end getSeverity    //-------------------------------------------------------------------------    // FH       8 Jan. 20001    /**     * Return a string holding the user readeable error message.     *     * @return Return a string of the user error message.     */    public final String getUserErrorMsg ()    {        return mUserErrorMsg;    }    //-------------------------------------------------------------------------    // FH       8 Jan. 20001    /**     * Return a string holding the internal (jahia) error message.     *     * @return Return a string of the internal error message.     */    public final String getJahiaErrorMsg ()    {        return mJahiaErrorMsg;    }    //-------------------------------------------------------------------------    // FH       8 Jan. 20001    /**     * Return the error code.     *     * @return Return the error code.     */    public final int getErrorCode ()    {        return mErrorCode;    }    /**     * Accessor method for the root cause exception.     * @returns Throwable the return value is an exception OR can be null in     * which case this signifies we didn't specify at creation the original source     * of the exception (or that this was an original exception we generated and     * didn't need to catch).     * @author Serge Huber     */    public final Throwable getRootCause() {        return mRootCauseException;    }    public String toString() {        StringBuffer result = new StringBuffer();        result.append(super.toString());        if (getRootCause() != null) {            result.append(" root cause=");            result.append(getRootCause().toString());        }        return result.toString();    }    public void printStackTrace(PrintWriter s) {        super.printStackTrace(s);        if (getRootCause() != null) {            getRootCause().printStackTrace(s);        }    }    public void printStackTrace(PrintStream s) {        super.printStackTrace(s);        if (getRootCause() != null) {            getRootCause().printStackTrace(s);        }    }    public void printStackTrace() {        super.printStackTrace();        if (getRootCause() != null) {            getRootCause().printStackTrace();        }    }} // end JahiaException

⌨️ 快捷键说明

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