private void checkStarted() throws UnifyException { if (!started) { throw new UnifyException(UnifyCoreErrorConstants.CONTAINER_NOT_INITIALIZED); } }
public UnifyException(Throwable cause, String errorCode, Object... errorParams) { super(UnifyException.buildMessage(errorCode, errorParams), cause); this.unifyError = new UnifyError(errorCode, errorParams); }
throw (UnifyException) e; } else { throw new UnifyException(UnifyCoreErrorConstants.COMPONENT_OPERATION_ERROR, e); String errorCode = ((UnifyException) e).getUnifyError().getErrorCode(); loginRequired = UnifyWebErrorConstants.LOGIN_REQUIRED.equals(errorCode) || SystemUtils.isForceLogoutErrorCode(errorCode);
/** * Gets a message from an exception. If the exception is an instance of * {@link UnifyException}, the method uses the exception's error code and error * parameters to obtain a formatted message from the messages component; which * is then returned as the result. Otherwise, the exception * {@link Exception#getMessage()} is returned. * * @param localeType * the locals type * @param exception * the exception to get message from. Can not be null. * @return the exception message * @throws UnifyException * if an error occurs */ protected String getExceptionMessage(LocaleType localeType, Exception exception) throws UnifyException { if (exception instanceof UnifyException) { UnifyError err = ((UnifyException) exception).getUnifyError(); return unifyComponentContext.getMessages().getMessage(getLocale(localeType), err.getErrorCode(), err.getErrorParams()); } return exception.getMessage(); }
private void log(LoggingLevel loggingLevel, String message, Object... params) { try { Logger logger = unifyComponentContext.getLogger(); if (logger.isEnabled(loggingLevel)) { logger.log(loggingLevel, resolveApplicationMessage(message, params)); } } catch (UnifyException e) { e.printStackTrace(); } }
UnifyError ue = ((UnifyException) e).getUnifyError(); error.setErrorCode(ue.getErrorCode()); error.setErrorMsg(getSessionMessage(ue.getErrorCode(), ue.getErrorParams())); } else { if (e.getCause() instanceof UnifyException) { UnifyError ue = ((UnifyException) e.getCause()).getUnifyError(); error.setErrorCode(ue.getErrorCode()); error.setErrorMsg(getSessionMessage(ue.getErrorCode(), ue.getErrorParams()));
private void log(LoggingLevel loggingLevel, Exception exception) { try { Logger logger = unifyComponentContext.getLogger(); if (logger.isEnabled(loggingLevel)) { logger.log(loggingLevel, getExceptionMessage(LocaleType.APPLICATION, exception), exception); } } catch (UnifyException e) { e.printStackTrace(); } } }
private static UnifyContainer getContainer() throws UnifyException { if (uc == null) { throw new UnifyException(UnifyCoreErrorConstants.NO_CONTAINER_IN_RUNTIME); } return uc; }
try { if (e instanceof UnifyException) { UnifyError err = ((UnifyException) e).getUnifyError(); taskMonitor.addMessage(getUnifyComponentContext().getMessages() .getMessage(Locale.getDefault(), err.getErrorCode(), err.getErrorParams()));
System.err .println("Failed reading configuration file - " + IOUtils.buildFilename(workingFolder, configFile)); e.printStackTrace(System.err); System.exit(1); } finally { } catch (UnifyException e) { System.err.println("Error initializing Unify container."); e.printStackTrace(System.err); System.exit(1);
public UnifyException(String errorCode, Object... errorParams) { super(UnifyException.buildMessage(errorCode, errorParams)); this.unifyError = new UnifyError(errorCode, errorParams); }
public SqlFieldInfo getListFieldInfo(String name) throws UnifyException { SqlFieldInfo sqlFieldInfo = listFieldInfoByName.get(name); if (sqlFieldInfo == null) { throw new UnifyException(UnifyCoreErrorConstants.RECORD_LISTFIELDINFO_NOT_FOUND, this.entityClass, name); } return sqlFieldInfo; }
public UnifyException(UnifyError unifyError) { super(UnifyException.buildMessage(unifyError.getErrorCode(), unifyError.getErrorParams())); this.unifyError = unifyError; }
@Override public TaskableMethodConfig getTaskableMethodConfig(String taskName) throws UnifyException { TaskableMethodConfig bmtc = taskConfigByNameMap.get(taskName); if (bmtc == null) { throw new UnifyException(UnifyCoreErrorConstants.TASKABLE_METHOD_UNKNOWN, taskName); } return bmtc; }
@Override public UplElement getChildElementByLongName(String longName) throws UnifyException { UplElement uplElement = uplElementByLongNameMap.get(longName); if (uplElement == null) { throw new UnifyException(UnifyCoreErrorConstants.PAGEUTIL_MISSING_ELEMENT, longName); } return uplElement; }
public static String getEventJS(String eventType) throws UnifyException { String eventJS = eventToJSMap.get(eventType); if (eventJS == null) { throw new UnifyException(UnifyWebErrorConstants.MISSING_ACTION_HANDLER, eventType); } return eventJS; }
public String getLongName(String pageName) throws UnifyException { String longName = longNameByPageNameMap.get(pageName); if (longName == null) { throw new UnifyException(UnifyCoreErrorConstants.UNKNOWN_PAGE_NAME, pageName); } return longName; }
public FieldConfig getFieldConfig(String fieldName) throws UnifyException { FieldConfig fc = fieldConfigs.get(fieldName); if (fc == null) { throw new UnifyException(UnifyCoreErrorConstants.DOCUMENT_NO_SUCH_FIELD, fieldName); } return fc; }
private String encodeURLParameter(String parameter) throws UnifyException { try { return URLEncoder.encode(parameter, "UTF-8"); } catch (UnsupportedEncodingException e) { throw new UnifyException(e, UnifyCoreErrorConstants.UTIL_ERROR); } }
public static String getActionJSFunction(String actionType) throws UnifyException { String functionName = actionToJSMap.get(actionType); if (functionName == null) { throw new UnifyException(UnifyWebErrorConstants.MISSING_ACTION_HANDLER, actionType); } return functionName; }