@Override public void setDynamicAttribute(final String uri, final String localName, final Object value) { params.add(new String[] {localName, StringUtil.toSafeString(value)}); }
/** * Prints out the message. User can override this method and modify the way * the message is printed. */ protected void printAfter(final ActionRequest request, final long executionTime, final Object result) { StringBuilder message = new StringBuilder(prefixOut); String resultString = StringUtil.toSafeString(result); if (resultString.length() > 70) { resultString = resultString.substring(0, 70); resultString += "..."; } message.append(request.getActionPath()).append(" (") .append(resultString).append(") in ").append(executionTime) .append("ms."); out(message.toString()); }
/** * Reads non-empty, trimmed, annotation element value. If annotation value is * missing, it will read value from default annotation. If still missing, * returns <code>null</code>. */ protected String readStringElement(A annotation, String name) { Object annotationValue = ReflectUtil.readAnnotationValue(annotation, name); if (annotationValue == null) { if (defaultAnnotation == null) { return null; } annotationValue = ReflectUtil.readAnnotationValue(defaultAnnotation, name); if (annotationValue == null) { return null; } } String value = StringUtil.toSafeString(annotationValue); return value.trim(); }
/** * Reads non-empty, trimmed, annotation element value. If annotation value is * missing, it will read value from default annotation. If still missing, * returns <code>null</code>. */ protected String readStringElement(final String name) { final Annotation annotation = annotatedElement.getAnnotation(annotationClass); Object annotationValue = ClassUtil.readAnnotationValue(annotation, name); if (annotationValue == null) { if (defaultAnnotation == null) { return null; } annotationValue = ClassUtil.readAnnotationValue(defaultAnnotation, name); if (annotationValue == null) { return null; } } String value = StringUtil.toSafeString(annotationValue); return value.trim(); }
/** * Returns byte array of created class. */ public byte[] create() { process(); byte[] result = toByteArray(); dumpClassInDebugFolder(result); if ((!proxetta.isForced()) && (!isProxyApplied())) { if (log.isDebugEnabled()) { log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); } return null; } if (log.isDebugEnabled()) { log.debug("Proxy created " + StringUtil.toSafeString(targetClassName)); } return result; }
@Test void testToString() { assertEquals("aaa", StringUtil.toString("aaa")); assertEquals("173", StringUtil.toString(Integer.valueOf(173))); assertNull(StringUtil.toString(null)); assertEquals("", StringUtil.toSafeString(null)); assertEquals("3", StringUtil.toSafeString(Long.valueOf(3))); }
log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); log.debug("Proxy created: " + StringUtil.toSafeString(targetClassName));
@Override public void setDynamicAttribute(final String uri, final String localName, final Object value) { params.add(new String[] {localName, StringUtil.toSafeString(value)}); }
/** * Prints out the message. User can override this method and modify the way * the message is printed. */ protected void printAfter(ActionRequest request, long executionTime, Object result) { StringBuilder message = new StringBuilder("<----- "); String resultString = StringUtil.toSafeString(result); if (resultString.length() > 70) { resultString = resultString.substring(0, 70); resultString += "..."; } message.append(request.getActionPath()).append(" (").append(resultString); message.append(") in ").append(executionTime).append("ms."); out(message.toString()); }
@Override public void error(String message, Throwable throwable, Object... values) { // manually create the message in order to print stack trace. // it's a bug with logback as it does not print the stacktrace // when error(string, throwable, string...) is used. for (Object value : values) { String str = StringUtil.toSafeString(value); message = StringUtil.replaceFirst(message, "{}", str); } if (locationAwareLogger != null) { locationAwareLogger.log( null, FQCN, LocationAwareLogger.ERROR_INT, message, values, throwable); } else { logger.error(message, throwable); } }
/** * Reads non-empty, trimmed, annotation element value. If annotation value is * missing, it will read value from default annotation. If still missing, * returns <code>null</code>. */ protected String readStringElement(final String name) { final Annotation annotation = annotatedElement.getAnnotation(annotationClass); Object annotationValue = ClassUtil.readAnnotationValue(annotation, name); if (annotationValue == null) { if (defaultAnnotation == null) { return null; } annotationValue = ClassUtil.readAnnotationValue(defaultAnnotation, name); if (annotationValue == null) { return null; } } String value = StringUtil.toSafeString(annotationValue); return value.trim(); }
/** * Reads non-empty, trimmed, annotation element value. If annotation value is * missing, it will read value from default annotation. If still missing, * returns <code>null</code>. */ protected String readStringElement(A annotation, String name) { Object annotationValue = ReflectUtil.readAnnotationValue(annotation, name); if (annotationValue == null) { if (defaultAnnotation == null) { return null; } annotationValue = ReflectUtil.readAnnotationValue(defaultAnnotation, name); if (annotationValue == null) { return null; } } String value = StringUtil.toSafeString(annotationValue); return value.trim(); }
/** * Returns byte array of created class. */ public byte[] create() { process(); byte[] result = toByteArray(); dumpClass(result); if ((proxetta.isForced() == false) && (isProxyApplied() == false)) { if (log.isDebugEnabled()) { log.debug("proxy not applied " + StringUtil.toSafeString(targetClassName)); } return null; } if (log.isDebugEnabled()) { log.debug("proxy created " + StringUtil.toSafeString(targetClassName)); } return result; }
/** * Returns byte array of created class. */ public byte[] create() { process(); byte[] result = toByteArray(); dumpClassInDebugFolder(result); if ((!proxetta.isForced()) && (!isProxyApplied())) { if (log.isDebugEnabled()) { log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); } return null; } if (log.isDebugEnabled()) { log.debug("Proxy created " + StringUtil.toSafeString(targetClassName)); } return result; }
log.debug("proxy not applied " + StringUtil.toSafeString(targetClassName)); log.debug("proxy created " + StringUtil.toSafeString(targetClassName));
log.debug("Proxy not applied: " + StringUtil.toSafeString(targetClassName)); log.debug("Proxy created: " + StringUtil.toSafeString(targetClassName));