public static String formatErrorCodeName(ErrorCode errorCode) { String packageName = errorCode.getErrorGroup().getPackage().getName(); String errorCodeName = errorCode.getName(); return CorePackageDefinitions.CORE_PACKAGE_NAME.equals(packageName) ? errorCodeName : packageName + "/" + errorCodeName; }
public static String formatErrorCodeName(ErrorCode errorCode) { String packageName = errorCode.getErrorGroup().getPackage().getName(); String errorCodeName = errorCode.getName(); return CorePackageDefinitions.CORE_PACKAGE_NAME.equals(packageName) ? errorCodeName : packageName + "/" + errorCodeName; }
public static String formatErrorCodeName(ErrorCode errorCode) { String packageName = errorCode.getErrorGroup().getPackage().getName(); String errorCodeName = errorCode.getName(); return CorePackageDefinitions.CORE_PACKAGE_NAME.equals(packageName) ? errorCodeName : packageName + "/" + errorCodeName; }
/** * Creates a DOM {@link Element} containing information about the given error, including * either just the {@link ErrorCode} or full details. * * @param ownerDocument {@link Document} that will contain the resulting element. * @param error {@link InputError} to format * @param fullDetails false if you just want the error code, true for full details. */ public static Element formatErrorAsXML(Document ownerDocument, InputError error, boolean fullDetails) { Element result = ownerDocument.createElementNS(SnuggleConstants.SNUGGLETEX_NAMESPACE, "error"); result.setAttribute("code", error.getErrorCode().getName()); result.setAttribute("package", error.getErrorCode().getErrorGroup().getPackage().getName()); if (fullDetails) { /* Nicely format XML error content */ StringBuffer messageBuilder = new StringBuffer(getErrorMessage(error)); FrozenSlice errorSlice = error.getSlice(); if (errorSlice!=null) { appendSliceContext(messageBuilder, errorSlice); } /* Add message as child node */ result.appendChild(ownerDocument.createTextNode(messageBuilder.toString())); } /* That's it! */ return result; }
/** * Creates a DOM {@link Element} containing information about the given error, including * either just the {@link ErrorCode} or full details. * * @param ownerDocument {@link Document} that will contain the resulting element. * @param error {@link InputError} to format * @param fullDetails false if you just want the error code, true for full details. */ public static Element formatErrorAsXML(Document ownerDocument, InputError error, boolean fullDetails) { Element result = ownerDocument.createElementNS(SnuggleConstants.SNUGGLETEX_NAMESPACE, "error"); result.setAttribute("code", error.getErrorCode().getName()); result.setAttribute("package", error.getErrorCode().getErrorGroup().getPackage().getName()); if (fullDetails) { /* Nicely format XML error content */ StringBuffer messageBuilder = new StringBuffer(getErrorMessage(error)); FrozenSlice errorSlice = error.getSlice(); if (errorSlice!=null) { appendSliceContext(messageBuilder, errorSlice); } /* Add message as child node */ result.appendChild(ownerDocument.createTextNode(messageBuilder.toString())); } /* That's it! */ return result; }
result.setAttribute("code", error.getErrorCode().getName()); result.setAttribute("package", error.getErrorCode().getErrorGroup().getPackage().getName());