public static ErrorMessageBuilder create() { return new ErrorMessageBuilder(); }
public ErrorMessageBuilder errorSettingExpressionWithValue(String expr, Object value) { appenExpression(expr); if (value instanceof Object[]) { appendValueAsArray((Object[]) value, message); } else { appendValue(value); } return this; }
private void handleRuntimeException(String expr, Object value, boolean throwExceptionOnFailure, RuntimeException re) { if (throwExceptionOnFailure) { String message = ErrorMessageBuilder.create() .errorSettingExpressionWithValue(expr, value) .build(); throw new XWorkException(message, re); } else { if (LOG.isWarnEnabled()) { LOG.warn("Error setting value [#0] with expression [#1]", re, value.toString(), expr); } } }
private void appendValueAsArray(Object[] valueArray, StringBuilder msg) { msg.append("["); for (int index = 0; index < valueArray.length; index++) { appendValue(valueArray[index]); if (hasMoreElements(valueArray, index)) { msg.append(", "); } } msg.append("]"); }
private void handleOgnlException(String expr, Object value, boolean throwExceptionOnFailure, OgnlException e) { boolean shouldLog = shouldLogMissingPropertyWarning(e); String msg = null; if (throwExceptionOnFailure || shouldLog) { msg = ErrorMessageBuilder.create() .errorSettingExpressionWithValue(expr, value) .build(); } if (shouldLog) { LOG.warn(msg, e); } if (throwExceptionOnFailure) { throw new XWorkException(msg, e); } }