📄 faultcodes.java
字号:
public static final int IDX_STYLE_NOT_FOUND = (int) (371l); // // Constant value // public static final int IDX_CORRUPTED = (int) (372l); // // Constant value // public static final int IDX_CANNOT_CREATE = (int) (373l); // // Constant value // public static final int TRX_DOC_LOCKED = (int) (400l); // // Constant value // public static final int TRX_NO_CONTEXT = (int) (440l); // // Constant value // public static final int TRX_NOT_ACTIVE = (int) (441l); // // Constant value // public static final int TRX_NOT_SUPPORTED = (int) (470l); // // Constant value // public static final int DBE_NO_PARENT = (int) (500l); // // Constant value // public static final int DBE_CANNOT_DROP = (int) (570l); // // Constant value // public static final int DBE_CANNOT_CREATE = (int) (571l); // // Constant value // public static final int QRY_NULL_RESULT = (int) (600l); // // Constant value // public static final int QRY_COMPILATION_ERROR = (int) (640l); // // Constant value // public static final int QRY_PROCESSING_ERROR = (int) (641l); // // Constant value // public static final int QRY_NOT_SUPPORTED = (int) (670l); // // Constant value // public static final int QRY_STYLE_NOT_FOUND = (int) (671l); // // Constant value // public static final int SEC_INVALID_USER = (int) (770l); // // Constant value // public static final int SEC_INVALID_GROUP = (int) (771l); // // Constant value // public static final int SEC_INVALID_ACCESS = (int) (772l); // // Constant value // public static final int SEC_INVALID_CREDENTIALS = (int) (773l); // // Constant value // public static final int URI_EMPTY = (int) (800l); // // Constant value // public static final int URI_NULL = (int) (801l); // // Constant value // public static final int URI_PARSE_ERROR = (int) (820l); // // Constant value // public static final int JAVA_RUNTIME_ERROR = (int) (2070l); private static final Map<Integer, String> FaultMsg = new HashMap<Integer, String>(); private FaultCodes() {} static { // General errors 0 series putCodeMessage(GEN_UNKNOWN, "Unknown"); putCodeMessage(GEN_GENERAL_ERROR, "General Error"); putCodeMessage(GEN_CRITICAL_ERROR, "Critical Error"); putCodeMessage(GEN_FATAL_ERROR, "Fatal Error"); // XMLObject invocation errors 100 series putCodeMessage(OBJ_OBJECT_NOT_FOUND, "XMLObject Not Found"); putCodeMessage(OBJ_METHOD_NOT_FOUND, "XMLObject Method Not Found"); putCodeMessage(OBJ_NULL_RESULT, "XMLObject Null Result"); putCodeMessage(OBJ_INVALID_RESULT, "XMLObject Invalid Result"); putCodeMessage(OBJ_DUPLICATE_OBJECT, "XMLObject Duplicate Object"); putCodeMessage(OBJ_RUNTIME_EXCEPTION, "XMLObject Runtime Exception"); putCodeMessage(OBJ_CLASS_FORMAT_ERROR, "XMLObject Class Format Error"); putCodeMessage(OBJ_INVALID_CONTEXT, "XMLObject Invalid Context"); putCodeMessage(OBJ_CANNOT_CREATE, "XMLObject Cannot Create"); // Collection-related errors 200 series putCodeMessage(COL_COLLECTION_NOT_FOUND, "Collection Not Found"); putCodeMessage(COL_DOCUMENT_NOT_FOUND, "Collection Document Not Found"); putCodeMessage(COL_DUPLICATE_COLLECTION, "Collection Duplicated"); putCodeMessage(COL_NULL_RESULT, "Collection Null Result"); putCodeMessage(COL_NO_FILER, "Collection No Filer"); putCodeMessage(COL_NO_INDEXMANAGER, "Collection No IndexManager"); putCodeMessage(COL_DOCUMENT_MALFORMED, "Collection Document Malformed"); putCodeMessage(COL_CANNOT_STORE, "Collection Cannot Store"); putCodeMessage(COL_CANNOT_RETRIEVE, "Collection Cannot Retrieve"); putCodeMessage(COL_COLLECTION_READ_ONLY, "Collection Read-only"); putCodeMessage(COL_COLLECTION_CLOSED, "Collection Closed"); putCodeMessage(COL_CANNOT_CREATE, "Collection Cannot Create"); putCodeMessage(COL_CANNOT_DROP, "Collection Cannot Drop"); // Index-related errors 300 series putCodeMessage(IDX_VALUE_NOT_FOUND, "Index Value Not Found"); putCodeMessage(IDX_INDEX_NOT_FOUND, "Index Not Found"); putCodeMessage(IDX_MATCHES_NOT_FOUND, "Index Matches Not Found"); putCodeMessage(IDX_DUPLICATE_INDEX, "Index Duplicate Index"); putCodeMessage(IDX_NOT_SUPPORTED, "Index Not Supported"); putCodeMessage(IDX_STYLE_NOT_FOUND, "Index Style Not Found"); putCodeMessage(IDX_CORRUPTED, "Index Corrupted"); putCodeMessage(IDX_CANNOT_CREATE, "Index Cannot Create"); // Transaction-related errors 400 series putCodeMessage(TRX_DOC_LOCKED, "Transaction Document Locked"); putCodeMessage(TRX_NO_CONTEXT, "Transaction No Context"); putCodeMessage(TRX_NOT_ACTIVE, "Transaction Not Active"); putCodeMessage(TRX_NOT_SUPPORTED, "Transaction Not Supported"); // Database-related errors 500 series putCodeMessage(DBE_NO_PARENT, "Database No Parent"); putCodeMessage(DBE_CANNOT_DROP, "Database Cannot Drop"); putCodeMessage(DBE_CANNOT_CREATE, "Database Cannot Create"); // Query-related errors 600 series putCodeMessage(QRY_NULL_RESULT, "Query Null Result"); putCodeMessage(QRY_COMPILATION_ERROR, "Query Compilation Error"); putCodeMessage(QRY_PROCESSING_ERROR, "Query Processing Error"); putCodeMessage(QRY_NOT_SUPPORTED, "Query Not Supported"); putCodeMessage(QRY_STYLE_NOT_FOUND, "Query Style Not Found"); // Security-related errors 700 series putCodeMessage(SEC_INVALID_USER, "Security Invalid User"); putCodeMessage(SEC_INVALID_GROUP, "Security Invalid Group"); putCodeMessage(SEC_INVALID_ACCESS, "Security Invalid Access"); putCodeMessage(SEC_INVALID_CREDENTIALS, "Security Invalid Credentials"); // URI-related errors 800 series putCodeMessage(URI_EMPTY, "URI Empty"); putCodeMessage(URI_NULL, "URI Null"); putCodeMessage(URI_PARSE_ERROR, "URI Parse Error"); // Java-related errors 2000 series putCodeMessage(JAVA_RUNTIME_ERROR, "Java Runtime Error"); } private static void putCodeMessage(int code, String message) { FaultMsg.put(code, message); } /** * getMessage returns a textual form for the specified fault code. * * @param code The Fault Code * @return It's textual form */ public static String getMessage(int code) { String msg = FaultMsg.get(code); return msg != null ? msg : ""; } /** * getFaultCodeType examines the provided exception to determine * the general fault code that is associated with it. General * fault codes are reduced from actual fault codes to be one of * the GEN_ prefixed fault code values. * * @param e The Exception to examine * @return The General Fault Code */ public static int getFaultCodeType(Exception e) { int code = 0; if (e instanceof DBException) { code = ((DBException) e).faultCode; } // Strip it to the General series code = code % 100; // Narrow to a General value code = code - (code % 10); return code; } /** * getFaultCodeSeries examines the provided exception to * determine the fault code series that is associated with it. * Series are reduced from actual fault codes to be one of * the fault code prefixes (ex: COL, DB, SEC). * * @param e The Exception to examine * @return The Fault Code Series */ public static int getFaultCodeSeries(Exception e) { int code = 0; if (e instanceof DBException) { code = ((DBException) e).faultCode; } // Strip it to the series code = code - (code % 100); return code; } /** * getFaultCode examines the provided exception to determine * the fault code that is associated with it. * * @param e The Exception to examine * @return The Fault Code */ public static int getFaultCode(Exception e) { if (e instanceof DBException) { return ((DBException) e).faultCode; } else { return 0; } } /** * getFaultMessage examines the provided exception to determine * the fault message that is associated with it. * * @param e The Exception to examine * @return The Fault Message */ public static String getFaultMessage(Exception e) { return getMessage(getFaultCode(e)); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -