WW-4504 - Mark current logging layer as @deprecated and use Log4j2 as default one

- Use log4j2 placeholder for logging messages and optimize logging a bit
This commit is contained in:
Johannes Geppert
2015-05-25 21:25:50 +02:00
parent 95805e54f7
commit 8e8771153a
91 changed files with 416 additions and 836 deletions
@@ -121,13 +121,11 @@ public class RequestUtils {
try {
return fastDateFormat.parse(headerValue);
} catch (ParseException ignore) {
if (LOG.isDebugEnabled()) {
LOG.debug("Error parsing value [#0] as [#1]!", headerValue, fastDateFormat);
}
LOG.debug("Error parsing value [{}] as [{}]!", headerValue, fastDateFormat);
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("Error parsing value [#0] as date!", headerValue);
LOG.debug("Error parsing value [{}] as date!", headerValue);
}
return null;
}
@@ -287,15 +287,15 @@ public class Date extends ContextBean {
date = ((Calendar) dateObject).getTime();
} else {
if (devMode) {
LOG.error("Expression [#0] passed to <s:date/> tag which was evaluated to [#1](#2) isn't instance of java.util.Date nor java.util.Calendar!",
LOG.error("Expression [{}] passed to <s:date/> tag which was evaluated to [{}]({}) isn't instance of java.util.Date nor java.util.Calendar!",
name, dateObject, (dateObject != null ? dateObject.getClass() : "null"));
} else {
LOG.debug("Expression [#0] passed to <s:date/> tag which was evaluated to [#1](#2) isn't instance of java.util.Date nor java.util.Calendar!",
LOG.debug("Expression [{}] passed to <s:date/> tag which was evaluated to [{}]({}) isn't instance of java.util.Date nor java.util.Calendar!",
name, dateObject, (dateObject != null ? dateObject.getClass() : "null"));
}
}
} catch (Exception e) {
LOG.error("Could not convert object with key '#0' to a java.util.Date instance", name);
LOG.error("Could not convert object with key '{}' to a java.util.Date instance", name);
}
//try to find the format on the stack
@@ -1006,9 +1006,7 @@ public abstract class UIBean extends Component {
// this check is needed for backwards compatibility with 2.1.x
tryId = findStringIfAltSyntax(id);
} else if (null == (generatedId = escape(name != null ? findString(name) : null))) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot determine id attribute for [#0], consider defining id, name or key attribute!", this);
}
LOG.debug("Cannot determine id attribute for [{}], consider defining id, name or key attribute!", this);
tryId = null;
} else if (form != null) {
tryId = form.getParameters().get("id") + "_" + generatedId;
@@ -93,7 +93,7 @@ public abstract class BaseTemplateEngine implements TemplateEngine {
if (servletContext != null) {
return servletContext.getResourceAsStream(path);
} else {
LOG.warn("ServletContext is null, cannot obtain #0", path);
LOG.warn("ServletContext is null, cannot obtain {}", path);
return null;
}
}
@@ -50,20 +50,20 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
String foundName = props.getProperty(key, DEFAULT_BEAN_NAME);
if (builder.contains(type, foundName)) {
if (LOG.isInfoEnabled()) {
LOG.info("Choosing bean (#0) for (#1)", foundName, type.getName());
LOG.info("Choosing bean ({}) for ({})", foundName, type.getName());
}
builder.alias(type, foundName, Container.DEFAULT_NAME);
} else {
try {
Class cls = ClassLoaderUtil.loadClass(foundName, this.getClass());
if (LOG.isDebugEnabled()) {
LOG.debug("Choosing bean (#0) for (#1)", cls.getName(), type.getName());
LOG.debug("Choosing bean ({}) for ({})", cls.getName(), type.getName());
}
builder.factory(type, cls, scope);
} catch (ClassNotFoundException ex) {
// Perhaps a spring bean id, so we'll delegate to the object factory at runtime
if (LOG.isDebugEnabled()) {
LOG.debug("Choosing bean (#0) for (#1) to be loaded from the ObjectFactory", foundName, type.getName());
LOG.debug("Choosing bean ({}) for ({}) to be loaded from the ObjectFactory", foundName, type.getName());
}
if (DEFAULT_BEAN_NAME.equals(foundName)) {
// Probably an optional bean, will ignore
@@ -77,9 +77,7 @@ public abstract class AbstractBeanSelectionProvider implements BeanSelectionProv
}
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to alias bean type (#0), default mapping already assigned.", type.getName());
}
LOG.warn("Unable to alias bean type ({}), default mapping already assigned.", type.getName());
}
}
@@ -466,12 +466,10 @@ public class DefaultBeanSelectionProvider extends AbstractBeanSelectionProvider
while (customBundles.hasMoreTokens()) {
String name = customBundles.nextToken();
try {
if (LOG.isInfoEnabled()) {
LOG.info("Loading global messages from [#0]", name);
}
LOG.info("Loading global messages from [{}]", name);
LocalizedTextUtil.addDefaultResourceBundle(name);
} catch (Exception e) {
LOG.error("Could not find messages file #0.properties. Skipping", name);
LOG.error("Could not find messages file {}.properties. Skipping", name);
}
}
}
@@ -66,7 +66,7 @@ public class DefaultDispatcherErrorHandler implements DispatcherErrorHandler {
if (code == HttpServletResponse.SC_INTERNAL_SERVER_ERROR) {
// WW-4103: Only logs error when application error occurred, not Struts error
if (LOG.isErrorEnabled()) {
LOG.error("Exception occurred during processing request: #0", e, e.getMessage());
LOG.error("Exception occurred during processing request: {}", e, e.getMessage());
}
// send a http error response to use the servlet defined error handler
// make the exception available to the web.xml defined error page
@@ -84,9 +84,7 @@ public class DefaultDispatcherErrorHandler implements DispatcherErrorHandler {
}
protected void handleErrorInDevMode(HttpServletResponse response, int code, Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Exception occurred during processing request: #0", e, e.getMessage());
}
LOG.debug("Exception occurred during processing request: {}", e, e.getMessage());
try {
List<Throwable> chain = new ArrayList<Throwable>();
Throwable cur = e;
@@ -214,7 +214,7 @@ public class DefaultStaticContentLoader implements StaticContentLoader {
ifModifiedSince = request.getDateHeader("If-Modified-Since");
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Invalid If-Modified-Since header value: '#0', ignoring", request.getHeader("If-Modified-Since"));
LOG.warn("Invalid If-Modified-Since header value: '{}', ignoring", request.getHeader("If-Modified-Since"));
}
}
long lastModifiedMillis = lastModifiedCal.getTimeInMillis();
@@ -288,7 +288,7 @@ public class Dispatcher {
}
catch(Exception e) {
// catch any exception that may occurred during destroy() and log it
LOG.error("exception occurred while destroying ObjectFactory [#0]", e, objectFactory.toString());
LOG.error("exception occurred while destroying ObjectFactory [{}]", e, objectFactory.toString());
}
}
@@ -333,9 +333,7 @@ public class Dispatcher {
if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER)) {
final String fileManagerClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER);
final Class<FileManager> fileManagerClass = (Class<FileManager>) Class.forName(fileManagerClassName);
if (LOG.isInfoEnabled()) {
LOG.info("Custom FileManager specified: #0", fileManagerClassName);
}
LOG.info("Custom FileManager specified: {}", fileManagerClassName);
configurationManager.addContainerProvider(new FileManagerProvider(fileManagerClass, fileManagerClass.getSimpleName()));
} else {
// add any other Struts 2 provided implementations of FileManager
@@ -344,9 +342,7 @@ public class Dispatcher {
if (initParams.containsKey(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY)) {
final String fileManagerFactoryClassName = initParams.get(StrutsConstants.STRUTS_FILE_MANAGER_FACTORY);
final Class<FileManagerFactory> fileManagerFactoryClass = (Class<FileManagerFactory>) Class.forName(fileManagerFactoryClassName);
if (LOG.isInfoEnabled()) {
LOG.info("Custom FileManagerFactory specified: #0", fileManagerFactoryClassName);
}
LOG.info("Custom FileManagerFactory specified: {}", fileManagerFactoryClassName);
configurationManager.addContainerProvider(new FileManagerFactoryProvider(fileManagerFactoryClass));
}
}
@@ -595,9 +591,9 @@ public class Dispatcher {
uri = uri + "?" + request.getQueryString();
}
if (devMode) {
LOG.error("Could not find action or result\n#0", e, uri);
LOG.error("Could not find action or result\n{}", uri, e);
} else if (LOG.isWarnEnabled()) {
LOG.warn("Could not find action or result: #0", e, uri);
LOG.warn("Could not find action or result: {}", uri, e);
}
}
@@ -196,7 +196,7 @@ public class HttpHeaderResult implements Result {
errorCode = Integer.parseInt(parse ? TextParseUtil.translateVariables(error, stack) : error);
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Cannot parse errorCode [#0] value as Integer!", e, error);
LOG.error("Cannot parse errorCode [{}] value as Integer!", error, e);
}
}
if (errorCode != -1) {
@@ -279,25 +279,17 @@ public class ServletRedirectResult extends StrutsResultSupport implements Reflec
URI uri = URI.create(rawUrl.replaceAll(" ", "%20"));
if (uri.isAbsolute()) {
URL validUrl = uri.toURL();
if (LOG.isDebugEnabled()) {
LOG.debug("[#0] is full url, not a path", url);
}
LOG.debug("[{}] is full url, not a path", url);
return validUrl.getProtocol() == null;
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("[#0] isn't absolute URI, assuming it's a path", url);
}
LOG.debug("[{}] isn't absolute URI, assuming it's a path", url);
return true;
}
} catch (IllegalArgumentException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
}
LOG.debug("[{}] isn't a valid URL, assuming it's a path", url, e);
return true;
} catch (MalformedURLException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("[#0] isn't a valid URL, assuming it's a path", e, url);
}
LOG.debug("[{}] isn't a valid URL, assuming it's a path", url, e);
return true;
}
}
@@ -159,9 +159,7 @@ public class VelocityResult extends StrutsResultSupport {
// to do it all the time (WW-829). Since Velocity support is being deprecated, we'll oblige :)
writer.flush();
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to render Velocity Template, '#0'", e, finalLocation);
}
LOG.error("Unable to render Velocity Template, '{}'", finalLocation, e);
throw e;
} finally {
if (usedJspFactory) {
@@ -384,17 +384,13 @@ public class DefaultActionMapper implements ActionMapper {
if (allowedActionNames.matcher(rawActionName).matches()) {
return rawActionName;
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Action [#0] does not match allowed action names pattern [#1], cleaning it up!",
rawActionName, allowedActionNames);
}
LOG.warn("Action [{}] does not match allowed action names pattern [{}], cleaning it up!",
rawActionName, allowedActionNames);
String cleanActionName = rawActionName;
for (String chunk : allowedActionNames.split(rawActionName)) {
cleanActionName = cleanActionName.replace(chunk, "");
}
if (LOG.isDebugEnabled()) {
LOG.debug("Cleaned action name [#0]", cleanActionName);
}
LOG.debug("Cleaned action name [{}]", cleanActionName);
return cleanActionName;
}
}
@@ -63,8 +63,8 @@ public class PrefixBasedActionMapper extends DefaultActionMapper implements Acti
Object obj = container.getInstance(ActionMapper.class, mapperName);
if (obj != null) {
actionMappers.put(mapperPrefix, (ActionMapper) obj);
} else if (LOG.isDebugEnabled()) {
LOG.debug("invalid PrefixBasedActionMapper config entry: [#0]", mapper);
} else {
LOG.debug("invalid PrefixBasedActionMapper config entry: [{}]", mapper);
}
}
}
@@ -79,30 +79,28 @@ public class PrefixBasedActionMapper extends DefaultActionMapper implements Acti
ActionMapper actionMapper = actionMappers.get(uri.substring(0, lastIndex));
if (actionMapper != null) {
ActionMapping actionMapping = actionMapper.getMapping(request, configManager);
if (LOG.isDebugEnabled()) {
LOG.debug("Using ActionMapper [#0]", actionMapper.toString());
}
LOG.debug("Using ActionMapper [{}]", actionMapper);
if (actionMapping != null) {
if (LOG.isDebugEnabled()) {
if (actionMapping.getParams() != null) {
LOG.debug("ActionMapper found mapping. Parameters: [#0]", actionMapping.getParams().toString());
LOG.debug("ActionMapper found mapping. Parameters: [{}]", actionMapping.getParams().toString());
for (Map.Entry<String, Object> mappingParameterEntry : actionMapping.getParams().entrySet()) {
Object paramValue = mappingParameterEntry.getValue();
if (paramValue == null) {
LOG.debug("[#0] : null!", mappingParameterEntry.getKey());
LOG.debug("[{}] : null!", mappingParameterEntry.getKey());
} else if (paramValue instanceof String[]) {
LOG.debug("[#0] : (String[]) #1", mappingParameterEntry.getKey(), Arrays.toString((String[]) paramValue));
LOG.debug("[{}] : (String[]) {}", mappingParameterEntry.getKey(), Arrays.toString((String[]) paramValue));
} else if (paramValue instanceof String) {
LOG.debug("[#0] : (String) [#1]", mappingParameterEntry.getKey(), paramValue.toString());
LOG.debug("[{}] : (String) [{}]", mappingParameterEntry.getKey(), paramValue.toString());
} else {
LOG.debug("[#0] : (Object) [#1]", mappingParameterEntry.getKey(), paramValue.toString());
LOG.debug("[{}] : (Object) [{}]", mappingParameterEntry.getKey(), paramValue.toString());
}
}
}
}
return actionMapping;
} else if (LOG.isDebugEnabled()) {
LOG.debug("ActionMapper [#0] failed to return an ActionMapping", actionMapper.toString());
} else {
LOG.debug("ActionMapper [{}] failed to return an ActionMapping", actionMapper);
}
}
}
@@ -118,13 +116,11 @@ public class PrefixBasedActionMapper extends DefaultActionMapper implements Acti
ActionMapper actionMapper = actionMappers.get(namespace.substring(0, lastIndex));
if (actionMapper != null) {
String uri = actionMapper.getUriFromActionMapping(mapping);
if (LOG.isDebugEnabled()) {
LOG.debug("Using ActionMapper [#0]", actionMapper.toString());
}
LOG.debug("Using ActionMapper [{}]", actionMapper);
if (uri != null) {
return uri;
} else if (LOG.isDebugEnabled()) {
LOG.debug("ActionMapper [#0] failed to return an ActionMapping (null)", actionMapper.toString());
LOG.debug("ActionMapper [{}] failed to return an ActionMapping (null)", actionMapper);
}
}
}
@@ -117,17 +117,13 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
protected String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled()) {
LOG.debug("Preparing error message for key: [#0]", errorKey);
}
LOG.debug("Preparing error message for key: [{}]", errorKey);
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
protected void processUpload(HttpServletRequest request, String saveDir) throws FileUploadException, UnsupportedEncodingException {
for (FileItem item : parseRequest(request, saveDir)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Found item " + item.getFieldName());
}
LOG.debug("Found file item: [{}]", item.getFieldName());
if (item.isFormField()) {
processNormalFormField(item, request.getCharacterEncoding());
} else {
@@ -137,13 +133,11 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
}
protected void processFileField(FileItem item) {
if (LOG.isDebugEnabled()) {
LOG.debug("Item is a file upload");
}
LOG.debug("Item is a file upload");
// Skip file uploads that don't have a file name - meaning that no file was selected.
if (item.getName() == null || item.getName().trim().length() < 1) {
LOG.debug("No file has been uploaded for the field: " + item.getFieldName());
LOG.debug("No file has been uploaded for the field: {}", item.getFieldName());
return;
}
@@ -159,9 +153,8 @@ public class JakartaMultiPartRequest implements MultiPartRequest {
}
protected void processNormalFormField(FileItem item, String charset) throws UnsupportedEncodingException {
if (LOG.isDebugEnabled()) {
LOG.debug("Item is a normal form field");
}
LOG.debug("Item is a normal form field");
List<String> values;
if (params.get(item.getFieldName()) != null) {
values = params.get(item.getFieldName());
@@ -120,9 +120,9 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
for (String fieldName : fileInfos.keySet()) {
for (FileInfo fileInfo : fileInfos.get(fieldName)) {
File file = fileInfo.getFile();
LOG.debug("Deleting file '#0'.", file.getName());
LOG.debug("Deleting file '{}'.", file.getName());
if (!file.delete())
LOG.warn("There was a problem attempting to delete file '#0'.", file.getName());
LOG.warn("There was a problem attempting to delete file '{}'.", file.getName());
}
}
}
@@ -306,7 +306,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
// also warn user in the logs.
if (!requestSizePermitted) {
addFileSkippedError(itemStream.getName(), request);
LOG.warn("Skipped stream '#0', request maximum size (#1) exceeded.", itemStream.getName(), maxSize);
LOG.warn("Skipped stream '{}', request maximum size ({}) exceeded.", itemStream.getName(), maxSize);
continue;
}
@@ -380,8 +380,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
}
values.add(fieldValue);
} catch (IOException e) {
e.printStackTrace();
LOG.warn("Failed to handle form field '#0'.", fieldName);
LOG.warn("Failed to handle form field '{}'.", fieldName, e);
}
}
@@ -404,8 +403,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
try {
file.delete();
} catch (SecurityException se) {
se.printStackTrace();
LOG.warn("Failed to delete '#0' due to security exception above.", file.getName());
LOG.warn("Failed to delete '{}' due to security exception above.", file.getName(), se);
}
}
}
@@ -434,7 +432,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
}
File file = File.createTempFile(prefix + "_", suffix, new File(location));
LOG.debug("Creating temporary file '#0' (originally '#1').", file.getName(), fileName);
LOG.debug("Creating temporary file '{}' (originally '{}').", file.getName(), fileName);
return file;
}
@@ -453,7 +451,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
try {
output = new BufferedOutputStream(new FileOutputStream(file), bufferSize);
byte[] buffer = new byte[bufferSize];
LOG.debug("Streaming file using buffer size #0.", bufferSize);
LOG.debug("Streaming file using buffer size {}.", bufferSize);
for (int length = 0; ((length = input.read(buffer)) > 0); )
output.write(buffer, 0, length);
result = true;
@@ -527,7 +525,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
private String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.message.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled())
LOG.debug("Preparing error message for key: [#0]", errorKey);
LOG.debug("Preparing error message for key: [{}]", errorKey);
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
@@ -541,7 +539,7 @@ public class JakartaStreamMultiPartRequest implements MultiPartRequest {
private String buildMessage(Throwable e, Object[] args) {
String messageKey = "struts.message.upload.message." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled())
LOG.debug("Preparing message for key: [#0]", messageKey);
LOG.debug("Preparing message for key: [{}]", messageKey);
return LocalizedTextUtil.findText(this.getClass(), messageKey, defaultLocale, e.getMessage(), args);
}
@@ -106,7 +106,7 @@ public class MultiPartRequestWrapper extends StrutsRequestWrapper {
protected String buildErrorMessage(Throwable e, Object[] args) {
String errorKey = "struts.messages.upload.error." + e.getClass().getSimpleName();
if (LOG.isDebugEnabled()) {
LOG.debug("Preparing error message for key: [#0]", errorKey);
LOG.debug("Preparing error message for key: [{}]", errorKey);
}
return LocalizedTextUtil.findText(this.getClass(), errorKey, defaultLocale, e.getMessage(), args);
}
@@ -60,8 +60,8 @@ public class PrefixBasedActionProxyFactory extends DefaultActionProxyFactory {
ActionProxyFactory obj = container.getInstance(ActionProxyFactory.class, factoryName);
if (obj != null) {
actionProxyFactories.put(factoryPrefix, obj);
} else if (LOG.isWarnEnabled()) {
LOG.warn("Invalid PrefixBasedActionProxyFactory config entry: [#0]", factory);
} else {
LOG.warn("Invalid PrefixBasedActionProxyFactory config entry: [{}]", factory);
}
}
}
@@ -76,17 +76,13 @@ public class PrefixBasedActionProxyFactory extends DefaultActionProxyFactory {
String key = uri.substring(0, lastIndex);
ActionProxyFactory actionProxyFactory = actionProxyFactories.get(key);
if (actionProxyFactory != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Using ActionProxyFactory [#0] for prefix [#1]", actionProxyFactory, key);
}
LOG.debug("Using ActionProxyFactory [{}] for prefix [{}]", actionProxyFactory, key);
return actionProxyFactory.createActionProxy(namespace, actionName, methodName, extraContext, executeResult, cleanupContext);
} else if (LOG.isDebugEnabled()) {
LOG.debug("No ActionProxyFactory defined for [#1]", key);
} else {
LOG.debug("No ActionProxyFactory defined for [{}]", key);
}
}
if (LOG.isDebugEnabled()){
LOG.debug("Cannot find any matching ActionProxyFactory, falling back to [#0]", defaultFactory);
}
LOG.debug("Cannot find any matching ActionProxyFactory, falling back to [{}]", defaultFactory);
return defaultFactory.createActionProxy(namespace, actionName, methodName, extraContext, executeResult, cleanupContext);
}
@@ -72,9 +72,7 @@ public class CheckboxInterceptor extends AbstractInterceptor {
Object values = entry.getValue();
iterator.remove();
if (values != null && values instanceof String[] && ((String[])values).length > 1) {
if (LOG.isDebugEnabled()) {
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: #0", name);
}
LOG.debug("Bypassing automatic checkbox detection due to multiple checkboxes of the same name: {}", name);
continue;
}
@@ -247,7 +247,7 @@ public class CookieInterceptor extends AbstractInterceptor {
populateCookieValueIntoStack(name, value, cookiesMap, stack);
}
} else {
LOG.warn("Cookie name [#0] with value [#1] was rejected!", name, value);
LOG.warn("Cookie name [{}] with value [{}] was rejected!", name, value);
}
}
}
@@ -288,12 +288,12 @@ public class CookieInterceptor extends AbstractInterceptor {
AcceptedPatternsChecker.IsAccepted accepted = acceptedPatternsChecker.isAccepted(name);
if (accepted.isAccepted()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Cookie [#0] matches acceptedPattern [#1]", name, accepted.getAcceptedPattern());
LOG.trace("Cookie [{}] matches acceptedPattern [{}]", name, accepted.getAcceptedPattern());
}
return true;
}
if (LOG.isTraceEnabled()) {
LOG.trace("Cookie [#0] doesn't match acceptedPattern [#1]", name, accepted.getAcceptedPattern());
LOG.trace("Cookie [{}] doesn't match acceptedPattern [{}]", name, accepted.getAcceptedPattern());
}
return false;
}
@@ -308,12 +308,12 @@ public class CookieInterceptor extends AbstractInterceptor {
ExcludedPatternsChecker.IsExcluded excluded = excludedPatternsChecker.isExcluded(name);
if (excluded.isExcluded()) {
if (LOG.isTraceEnabled()) {
LOG.trace("Cookie [#0] matches excludedPattern [#1]", name, excluded.getExcludedPattern());
LOG.trace("Cookie [{}] matches excludedPattern [{}]", name, excluded.getExcludedPattern());
}
return true;
}
if (LOG.isTraceEnabled()) {
LOG.trace("Cookie [#0] doesn't match excludedPattern [#1]", name, excluded.getExcludedPattern());
LOG.trace("Cookie [{}] doesn't match excludedPattern [{}]", name, excluded.getExcludedPattern());
}
return false;
}
@@ -335,9 +335,9 @@ public class CookieInterceptor extends AbstractInterceptor {
// we'll inject it into Struts' action
if (LOG.isDebugEnabled()) {
if (cookiesValueSet.isEmpty())
LOG.debug("no cookie value is configured, cookie with name ["+cookieName+"] with value ["+cookieValue+"] will be injected");
LOG.debug("no cookie value is configured, cookie with name [{}] with value [{}] will be injected", cookieName, cookieValue);
else if (cookiesValueSet.contains("*"))
LOG.debug("interceptor is configured to accept any value, cookie with name ["+cookieName+"] with value ["+cookieValue+"] will be injected");
LOG.debug("interceptor is configured to accept any value, cookie with name [{}] with value [{}] will be injected", cookieName, cookieValue);
}
cookiesMap.put(cookieName, cookieValue);
stack.setValue(cookieName, cookieValue);
@@ -347,7 +347,7 @@ public class CookieInterceptor extends AbstractInterceptor {
// inject them into Struts' action
if (cookiesValueSet.contains(cookieValue)) {
if (LOG.isDebugEnabled()) {
LOG.debug("both configured cookie name and value matched, cookie ["+cookieName+"] with value ["+cookieValue+"] will be injected");
LOG.debug("both configured cookie name and value matched, cookie [{}] with value [{}] will be injected", cookieName, cookieValue);
}
cookiesMap.put(cookieName, cookieValue);
@@ -365,9 +365,7 @@ public class CookieInterceptor extends AbstractInterceptor {
*/
protected void injectIntoCookiesAwareAction(Object action, Map<String, String> cookiesMap) {
if (action instanceof CookiesAware) {
if (LOG.isDebugEnabled()) {
LOG.debug("action ["+action+"] implements CookiesAware, injecting cookies map ["+cookiesMap+"]");
}
LOG.debug("Action [{}] implements CookiesAware, injecting cookies map [{}]", action, cookiesMap);
((CookiesAware)action).setCookiesMap(cookiesMap);
}
}
@@ -86,7 +86,7 @@ public class CookieProviderInterceptor extends AbstractInterceptor implements Pr
if (cookies != null) {
for (Cookie cookie : cookies) {
if (LOG.isDebugEnabled()) {
LOG.debug("Sending cookie [#0] with value [#1] for domain [#2]",
LOG.debug("Sending cookie [{}] with value [{}] for domain [{}]",
cookie.getName(), cookie.getValue(), (cookie.getDomain() != null ? cookie.getDomain() : "no domain"));
}
response.addCookie(cookie);
@@ -96,17 +96,13 @@ public class CookieProviderInterceptor extends AbstractInterceptor implements Pr
public void beforeResult(ActionInvocation invocation, String resultCode) {
try {
if (LOG.isTraceEnabled()) {
LOG.trace("beforeResult start");
}
LOG.trace("beforeResult start");
ActionContext ac = invocation.getInvocationContext();
if (invocation.getAction() instanceof CookieProvider) {
HttpServletResponse response = (HttpServletResponse) ac.get(StrutsStatics.HTTP_RESPONSE);
addCookiesToResponse((CookieProvider) invocation.getAction(), response);
}
if (LOG.isTraceEnabled()) {
LOG.trace("beforeResult end");
}
LOG.trace("beforeResult end");
} catch (Exception ex) {
LOG.error("Unable to setup cookies", ex);
}
@@ -111,7 +111,7 @@ public class I18nInterceptor extends com.opensymphony.xwork2.interceptor.I18nInt
@Override
public String intercept(ActionInvocation invocation) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("intercept '#0/#1' {",
LOG.debug("intercept '{}/{}' {",
invocation.getProxy().getNamespace(), invocation.getProxy().getActionName());
}
@@ -121,13 +121,13 @@ public class I18nInterceptor extends com.opensymphony.xwork2.interceptor.I18nInt
saveLocale(invocation, locale);
if (LOG.isDebugEnabled()) {
LOG.debug("before Locale=#0", invocation.getStack().findValue("locale"));
LOG.debug("before Locale={}", invocation.getStack().findValue("locale"));
}
final String result = invocation.invoke();
if (LOG.isDebugEnabled()) {
LOG.debug("after Locale=#0", invocation.getStack().findValue("locale"));
LOG.debug("after Locale={}", invocation.getStack().findValue("locale"));
LOG.debug("intercept } ");
}
@@ -107,7 +107,7 @@ public class RolesInterceptor extends AbstractInterceptor {
private void checkRoles(List<String> roles){
if (!areRolesValid(roles)){
LOG.fatal("An unknown Role was configured: #0", roles.toString());
LOG.fatal("An unknown Role was configured: {}", roles);
isProperlyConfigured = false;
throw new IllegalArgumentException("An unknown role was configured: " + roles);
}
@@ -118,7 +118,7 @@ public class StrutsUtil {
}
catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot include #0", e, aName.toString());
LOG.debug("Cannot include {}", e, aName.toString());
}
throw e;
}
@@ -128,9 +128,7 @@ public class StrutsUtil {
try {
return URLEncoder.encode(s, "UTF-8");
} catch (UnsupportedEncodingException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot encode URL [#0]", e, s);
}
LOG.debug("Cannot encode URL [{}]", s, e);
return s;
}
}
@@ -167,10 +167,8 @@ public class SubsetIteratorFilter extends IteratorFilterSupport implements Itera
return okToAdd;
}
catch(Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Decider [#0] encountered an error while decide adding element [#1], element will be ignored, it will not appeared in subseted iterator",
e, decider.toString(), element.toString());
}
LOG.warn("Decider [{}] encountered an error while decide adding element [{}], element will be ignored, it will not appeared in subseted iterator",
decider, element, e);
return false;
}
}
@@ -35,8 +35,8 @@ public class JBossFileManager extends DefaultFileManager {
@Override
public boolean support() {
boolean supports = isJBoss7() || isJBoss5();
if (supports && LOG.isDebugEnabled()) {
LOG.debug("JBoss server detected, Struts 2 will use [#0] to support file system operations!", JBossFileManager.class.getSimpleName());
if (supports) {
LOG.debug("JBoss server detected, Struts 2 will use [{}] to support file system operations!", JBossFileManager.class.getSimpleName());
}
return supports;
}
@@ -46,9 +46,7 @@ public class JBossFileManager extends DefaultFileManager {
Class.forName(VFS_JBOSS5);
return true;
} catch (ClassNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot load [#0] class, not a JBoss 5!", VFS_JBOSS5);
}
LOG.debug("Cannot load [{}] class, not a JBoss 5!", VFS_JBOSS5);
return false;
}
}
@@ -58,9 +56,7 @@ public class JBossFileManager extends DefaultFileManager {
Class.forName(VFS_JBOSS7);
return true;
} catch (ClassNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot load [#0] class, not a JBoss 7!", VFS_JBOSS7);
}
LOG.debug("Cannot load [{}] class, not a JBoss 7!", VFS_JBOSS7);
return false;
}
}
@@ -69,13 +65,9 @@ public class JBossFileManager extends DefaultFileManager {
public void monitorFile(URL fileUrl) {
if (isJBossUrl(fileUrl)) {
String fileName = fileUrl.toString();
if (LOG.isDebugEnabled()) {
LOG.debug("Creating revision for URL: " + fileName);
}
LOG.debug("Creating revision for URL: {}", fileName);
URL normalizedUrl = normalizeToFileProtocol(fileUrl);
if (LOG.isDebugEnabled()) {
LOG.debug("Normalized URL for [#0] is [#1]", fileName, normalizedUrl.toString());
}
LOG.debug("Normalized URL for [{}] is [{}]", fileName, normalizedUrl);
Revision revision;
if ("file".equals(normalizedUrl.getProtocol())) {
revision = FileRevision.build(normalizedUrl);
@@ -136,9 +128,7 @@ public class JBossFileManager extends DefaultFileManager {
protected URL getJBossPhysicalUrl(URL url) throws IOException {
Object content = url.openConnection().getContent();
String classContent = content.getClass().toString();
if (LOG.isDebugEnabled()) {
LOG.debug("Reading physical URL for [#0]", url.toString());
}
LOG.debug("Reading physical URL for [{}]", url);
if (classContent.startsWith("class org.jboss.vfs.VirtualFile")) { // JBoss 7 and probably 6
File physicalFile = readJBossPhysicalFile(content);
return physicalFile.toURI().toURL();
@@ -174,7 +164,7 @@ public class JBossFileManager extends DefaultFileManager {
Method method = content.getClass().getDeclaredMethod("getPhysicalFile");
return (File) method.invoke(content);
} catch (NoSuchMethodException e) {
LOG.error("Provided class content [#0] is not a JBoss VirtualFile, getPhysicalFile() method not found!", e, content.getClass().getSimpleName());
LOG.error("Provided class content [{}] is not a JBoss VirtualFile, getPhysicalFile() method not found!", content.getClass().getSimpleName(), e);
} catch (InvocationTargetException e) {
LOG.error("Cannot invoke getPhysicalFile() method!", e);
} catch (IllegalAccessException e) {
@@ -191,7 +181,7 @@ public class JBossFileManager extends DefaultFileManager {
method = handler.getClass().getMethod("getRealURL");
return (URL) method.invoke(handler);
} catch (NoSuchMethodException e) {
LOG.error("Provided class content [#0] is not a JBoss VirtualFile, getHandler() or getRealURL() method not found!", e, content.getClass().getSimpleName());
LOG.error("Provided class content [{}] is not a JBoss VirtualFile, getHandler() or getRealURL() method not found!", content.getClass().getSimpleName(), e);
} catch (InvocationTargetException e) {
LOG.error("Cannot invoke getHandler() or getRealURL() method!", e);
} catch (IllegalAccessException e) {
@@ -430,9 +430,7 @@ public class FreemarkerManager {
}
}
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Invalid template path specified: #0", e, e.getMessage());
}
LOG.error("Invalid template path specified: {}", e.getMessage(), e);
}
// presume that most apps will require the class and webapp template loader
@@ -83,9 +83,7 @@ public abstract class TagModel implements TemplateTransformModel {
try {
map.put(entry.getKey(), objectWrapper.unwrap((TemplateModel) value));
} catch (TemplateModelException e) {
if (LOG.isErrorEnabled()) {
LOG.error("failed to unwrap [#0] it will be ignored", e, value.toString());
}
LOG.error("failed to unwrap [{}] it will be ignored", value.toString(), e);
}
}
// if it doesn't, we'll do it the old way by just returning the toString() representation
@@ -259,9 +259,7 @@ public class DefaultUrlHelper implements UrlHelper {
try {
return URLEncoder.encode(input, encoding);
} catch (UnsupportedEncodingException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not encode URL parameter '#0', returning value un-encoded", input);
}
LOG.warn("Could not encode URL parameter '{}', returning value un-encoded", input);
return input;
}
}
@@ -276,9 +274,7 @@ public class DefaultUrlHelper implements UrlHelper {
try {
return URLDecoder.decode(input, encoding);
} catch (UnsupportedEncodingException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not decode URL parameter '#0', returning value un-decoded", input);
}
LOG.warn("Could not decode URL parameter '{}', returning value un-decoded", input);
return input;
}
}
@@ -123,7 +123,7 @@ public class BeanAdapter extends AbstractAdapterElement {
if (e instanceof InvocationTargetException)
e = (Exception) ((InvocationTargetException) e).getTargetException();
if (log.isErrorEnabled()) {
log.error("Cannot access bean property: #0", e, propertyName);
log.error("Cannot access bean property: {}", propertyName, e);
}
continue;
}
@@ -139,14 +139,11 @@ public class BeanAdapter extends AbstractAdapterElement {
if (childAdapter != null)
newAdapters.add(childAdapter);
if (log.isDebugEnabled()) {
log.debug(this + " adding adapter: " + childAdapter);
}
log.debug("{} adding adapter: {}", this, childAdapter);
}
} else {
// No properties found
log.info(
"Class " + type.getName() + " has no readable properties, " + " trying to adapt " + getPropertyName() + " with StringAdapter...");
log.info("Class {} has no readable properties, trying to adapt {} with StringAdapter...", type.getName(), getPropertyName());
}
return newAdapters;
@@ -422,9 +422,7 @@ public class XSLTResult implements Result {
}
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to render XSLT Template, '#0'", e, location);
}
LOG.error("Unable to render XSLT Template, '{}'", location, e);
throw e;
}
}
@@ -145,25 +145,19 @@ public class ConventionUnknownHandler implements UnknownHandler {
if (!actionName.equals("") && redirectToSlash) {
ResultTypeConfig redirectResultTypeConfig = parentPackage.getAllResultTypeConfigs().get("redirect");
String redirectNamespace = namespace + "/" + actionName;
if (LOG.isTraceEnabled()) {
LOG.trace("Checking if there is an action named index in the namespace [#0]",
redirectNamespace);
}
LOG.trace("Checking if there is an action named index in the namespace {}", redirectNamespace);
actionConfig = configuration.getRuntimeConfiguration().getActionConfig(redirectNamespace, "index");
if (actionConfig != null) {
if (LOG.isTraceEnabled())
LOG.trace("Found action config");
LOG.trace("Found action config");
PackageConfig packageConfig = configuration.getPackageConfig(actionConfig.getPackageName());
if (redirectNamespace.equals(packageConfig.getNamespace())) {
if (LOG.isTraceEnabled())
LOG.trace("Action is not a default - redirecting");
LOG.trace("Action is not a default - redirecting");
return buildActionConfig(redirectNamespace + "/", redirectResultTypeConfig);
}
if (LOG.isTraceEnabled())
LOG.trace("Action was a default - NOT redirecting");
LOG.trace("Action was a default - NOT redirecting");
}
if (resource != null) {
@@ -178,9 +172,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
// try to find index action in current namespace or in default one
if (actionConfig == null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Looking for action named [index] in namespace [#0] or in default namespace", namespace);
}
LOG.trace("Looking for action named [index] in namespace [#0] or in default namespace", namespace);
actionConfig = configuration.getRuntimeConfiguration().getActionConfig(namespace, "index");
}
}
@@ -198,9 +190,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
protected Resource findResource(Map<String, ResultTypeConfig> resultsByExtension, String... parts) {
for (String ext : resultsByExtension.keySet()) {
String canonicalPath = canonicalize(string(parts) + "." + ext);
if (LOG.isTraceEnabled()) {
LOG.trace("Checking for [#0]", canonicalPath);
}
LOG.trace("Checking for {}", canonicalPath);
try {
if (servletContext.getResource(canonicalPath) != null) {
@@ -208,7 +198,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
}
} catch (MalformedURLException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to parse path to the web application resource [#0] skipping...", canonicalPath);
LOG.error("Unable to parse path to the web application resource {} skipping...", canonicalPath);
}
}
}
@@ -249,8 +239,8 @@ public class ConventionUnknownHandler implements UnknownHandler {
for (String ext : resultsByExtension.keySet()) {
if (LOG.isTraceEnabled()) {
String fqan = ns + "/" + actionName;
LOG.trace("Trying to locate the correct result for the FQ action [#0]"
+ " with an file extension of [#1] in the directory [#2] " + "and a result code of [#3]",
LOG.trace("Trying to locate the correct result for the FQ action [{}]"
+ " with an file extension of [#1] in the directory [{}] " + "and a result code of [{}]",
fqan, ext, pathPrefix, resultCode);
}
@@ -292,7 +282,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
for (String ext : resultsByExtension.keySet()) {
if (LOG.isTraceEnabled()) {
String fqan = ns + "/" + actionName;
LOG.trace("Checking for [#0/index.#1]", fqan, ext);
LOG.trace("Checking for [{}/index.{}]", fqan, ext);
}
String path = string(pathPrefix, actionName, "/index", nameSeparator, resultCode, ".", ext);
@@ -317,7 +307,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
ActionConfig chainedToConfig = pkg.getActionConfigs().get(chainedTo);
if (chainedToConfig != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Action [#0] used as chain result for [#1] and result [#2]", chainedTo, actionName, resultCode);
LOG.trace("Action [{}] used as chain result for [{}] and result [{}]", chainedTo, actionName, resultCode);
}
ResultTypeConfig chainResultType = pkg.getAllResultTypeConfigs().get("chain");
@@ -333,7 +323,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
try {
boolean traceEnabled = LOG.isTraceEnabled();
if (traceEnabled)
LOG.trace("Checking ServletContext for [#0]", path);
LOG.trace("Checking ServletContext for {}", path);
if (servletContext.getResource(path) != null) {
if (traceEnabled)
@@ -342,7 +332,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
}
if (traceEnabled)
LOG.trace("Checking ClasLoader for #0", path);
LOG.trace("Checking ClasLoader for {}", path);
String classLoaderPath = path.startsWith("/") ? path.substring(1, path.length()) : path;
if (ClassLoaderUtil.getResource(classLoaderPath, getClass()) != null) {
@@ -352,7 +342,7 @@ public class ConventionUnknownHandler implements UnknownHandler {
}
} catch (MalformedURLException e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to parse template path: [#0] skipping...", path);
LOG.error("Unable to parse template path: {} skipping...", path);
}
return null;
@@ -79,7 +79,7 @@ public class DefaultInterceptorMapBuilder implements InterceptorMapBuilder {
10);
for (InterceptorRef interceptor : interceptors) {
if (LOG.isTraceEnabled())
LOG.trace("Adding interceptor [#0] to [#1]",
LOG.trace("Adding interceptor [{}] to [{}]",
interceptor.value(), actionName);
Map<String, String> params = StringTools.createParameterMap(interceptor
.params());
@@ -173,7 +173,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
}
if (LOG.isTraceEnabled()) {
LOG.trace("Using final calculated namespace [#0]", namespace);
LOG.trace("Using final calculated namespace [{}]", namespace);
}
// Add that ending slash for concatenation
@@ -243,7 +243,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
final String resultPath, final String resultPrefix, final String actionName,
PackageConfig packageConfig, Map<String, ResultTypeConfig> resultsByExtension) {
if (LOG.isTraceEnabled()) {
LOG.trace("Searching for results in the Servlet container at [#0]" +
LOG.trace("Searching for results in the Servlet container at [{}]" +
" with result prefix of [#1]", resultPath, resultPrefix);
}
@@ -252,23 +252,19 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
Set<String> paths = servletContext.getResourcePaths(flatResultLayout ? resultPath : resultPrefix);
if (paths != null) {
for (String path : paths) {
if (LOG.isTraceEnabled()) {
LOG.trace("Processing resource path [#0]", path);
}
LOG.trace("Processing resource path [{}]", path);
String fileName = StringUtils.substringAfterLast(path, "/");
if (StringUtils.isBlank(fileName) || StringUtils.startsWith(fileName, ".")) {
if (LOG.isTraceEnabled())
LOG.trace("Ignoring file without name [#0]", path);
LOG.trace("Ignoring file without name [{}]", path);
continue;
}
else if(fileName.lastIndexOf(".") > 0){
String suffix = fileName.substring(fileName.lastIndexOf(".")+1);
if(conventionsService.getResultTypesByExtension(packageConfig).get(suffix) == null) {
if (LOG.isDebugEnabled())
LOG.debug("No result type defined for file suffix : [#0]. Ignoring file #1", suffix, fileName);
continue;
LOG.debug("No result type defined for file suffix : [{}]. Ignoring file {}", suffix, fileName);
continue;
}
}
@@ -280,8 +276,8 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
String classPathLocation = resultPath.startsWith("/") ?
resultPath.substring(1, resultPath.length()) : resultPath;
if (LOG.isTraceEnabled()) {
LOG.trace("Searching for results in the class path at [#0]"
+ " with a result prefix of [#1] and action name [#2]", classPathLocation, resultPrefix,
LOG.trace("Searching for results in the class path at [{}]"
+ " with a result prefix of [{}] and action name [{}]", classPathLocation, resultPrefix,
actionName);
}
@@ -292,9 +288,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
Test<URL> resourceTest = getResourceTest(resultPath, actionName);
for (Map.Entry<String, URL> entry : matches.entrySet()) {
if (resourceTest.test(entry.getValue())) {
if (LOG.isTraceEnabled()) {
LOG.trace("Processing URL [#0]", entry.getKey());
}
LOG.trace("Processing URL [{}]", entry.getKey());
String urlStr = entry.getValue().toString();
int index = urlStr.lastIndexOf(resultPrefix);
@@ -305,8 +299,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
}
}
} catch (IOException ex) {
if (LOG.isErrorEnabled())
LOG.error("Unable to scan directory [#0] for results", ex, classPathLocation);
LOG.error("Unable to scan directory [{}] for results", ex, classPathLocation);
}
}
@@ -361,7 +354,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
// This case is when the path doesn't contain a result code
if (indexOfDot == resultPrefix.length()) {
if (LOG.isTraceEnabled()) {
LOG.trace("The result file [#0] has no result code and therefore" +
LOG.trace("The result file [{}] has no result code and therefore" +
" will be associated with success, input and error by default. This might" +
" be overridden by another result file or an annotation.", path);
}
@@ -373,7 +366,7 @@ public class DefaultResultMapBuilder implements ResultMapBuilder {
// This case is when the path contains a result code
} else if (indexOfDot > resultPrefix.length()) {
if (LOG.isTraceEnabled()) {
LOG.trace("The result file [#0] has a result code and therefore" +
LOG.trace("The result file [{}] has a result code and therefore" +
" will be associated with only that result code.", path);
}
@@ -143,7 +143,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
this.redirectToSlash = Boolean.parseBoolean(redirectToSlash);
if (LOG.isTraceEnabled()) {
LOG.trace("Setting action default parent package to [#0]", defaultParentPackage);
LOG.trace("Setting action default parent package to [{}]", defaultParentPackage);
}
this.defaultParentPackage = defaultParentPackage;
@@ -478,8 +478,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
if (includeJars == null) {
urlSet = urlSet.exclude(".*?\\.jar(!/|/)?");
} else {
LOG.debug("jar urls regexes were specified: #0", Arrays.asList(includeJars));
if(LOG.isDebugEnabled()) {
LOG.debug("jar urls regexes were specified: {}", Arrays.asList(includeJars));
}
List<URL> rawIncludedUrls = urlSet.getUrls();
Set<URL> includeUrls = new HashSet<URL>();
boolean[] patternUsed = new boolean[includeJars.length];
@@ -496,7 +497,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
}
}
} else {
LOG.debug("It is not a jar [#0]", url);
LOG.debug("It is not a jar [{}]", url);
includeUrls.add(url);
}
}
@@ -504,7 +505,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
if (LOG.isWarnEnabled()) {
for (int i = 0; i < patternUsed.length; i++) {
if (!patternUsed[i]) {
LOG.warn("The includeJars pattern [#0] did not match any jars in the classpath", includeJars[i]);
LOG.warn("The includeJars pattern [{}] did not match any jars in the classpath", includeJars[i]);
}
}
}
@@ -637,8 +638,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
try {
return inPackage && (nameMatches || (checkImplementsAction && com.opensymphony.xwork2.Action.class.isAssignableFrom(classInfo.get())));
} catch (ClassNotFoundException ex) {
if (LOG.isErrorEnabled())
LOG.error("Unable to load class [#0]", ex, classInfo.getName());
LOG.error("Unable to load class [{}]", ex, classInfo.getName());
return false;
}
}
@@ -655,8 +655,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
// Skip classes that can't be instantiated
if (cannotInstantiate(actionClass)) {
if (LOG.isTraceEnabled())
LOG.trace("Class [#0] did not pass the instantiation test and will be ignored", actionClass.getName());
LOG.trace("Class [{}] did not pass the instantiation test and will be ignored", actionClass.getName());
continue;
}
@@ -665,8 +664,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
try {
objectFactory.getClassInstance(actionClass.getName());
} catch (ClassNotFoundException e) {
if (LOG.isErrorEnabled())
LOG.error("Object Factory was unable to load class [#0]", e, actionClass.getName());
LOG.error("Object Factory was unable to load class [{}]", e, actionClass.getName());
throw new StrutsException("Object Factory was unable to load class " + actionClass.getName(), e);
}
}
@@ -674,7 +672,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
// Determine the action package
String actionPackage = actionClass.getPackage().getName();
if (LOG.isDebugEnabled()) {
LOG.debug("Processing class [#0] in package [#1]", actionClass.getName(), actionPackage);
LOG.debug("Processing class [{}] in package [{}]", actionClass.getName(), actionPackage);
}
// Determine the default namespace and action name
@@ -789,9 +787,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
//single namespace
Namespace namespaceAnnotation = AnnotationUtils.findAnnotation(actionClass, Namespace.class);
if (namespaceAnnotation != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Using non-default action namespace from Namespace annotation of [#0]", namespaceAnnotation.value());
}
LOG.trace("Using non-default action namespace from Namespace annotation of [{}]", namespaceAnnotation.value());
namespaces.add(namespaceAnnotation.value());
}
@@ -804,7 +800,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
for (Namespace namespace : namespacesAnnotation.value())
sb.append(namespace.value()).append(",");
sb.deleteCharAt(sb.length() - 1);
LOG.trace("Using non-default action namespaces from Namespaces annotation of [#0]", sb.toString());
LOG.trace("Using non-default action namespaces from Namespaces annotation of [{}]", sb.toString());
}
for (Namespace namespace : namespacesAnnotation.value())
@@ -859,9 +855,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
*/
protected String determineActionName(Class<?> actionClass) {
String actionName = actionNameBuilder.build(actionClass.getSimpleName());
if (LOG.isTraceEnabled()) {
LOG.trace("Got actionName for class [#0] of [#1]", actionClass.toString(), actionName);
}
LOG.trace("Got actionName for class [{}] of [{}]", actionClass.toString(), actionName);
return actionName;
}
@@ -939,7 +933,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
actionConfig.methodName(actionMethod);
if (LOG.isDebugEnabled()) {
LOG.debug("Creating action config for class [#0], name [#1] and package name [#2] in namespace [#3]",
LOG.debug("Creating action config for class [{}], name [{}] and package name [{}] in namespace [{}]",
actionClass.toString(), actionName, pkgCfg.getName(), pkgCfg.getNamespace());
}
@@ -972,8 +966,9 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
if (existingPkg != null) {
// there is a package already with that name, check action
ActionConfig existingActionConfig = existingPkg.getActionConfigs().get(actionName);
if (existingActionConfig != null && LOG.isWarnEnabled())
LOG.warn("Duplicated action definition in package [#0] with name [#1].", pkgCfg.getName(), actionName);
if (existingActionConfig != null && LOG.isWarnEnabled()) {
LOG.warn("Duplicated action definition in package [{}] with name [{}].", pkgCfg.getName(), actionName);
}
}
//watch class file
@@ -988,8 +983,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
List<ExceptionMappingConfig> exceptionMappings = new ArrayList<ExceptionMappingConfig>();
for (ExceptionMapping exceptionMapping : exceptions) {
if (LOG.isTraceEnabled())
LOG.trace("Mapping exception [#0] to result [#1] for action [#2]", exceptionMapping.exception(),
LOG.trace("Mapping exception [{}] to result [{}] for action [{}]", exceptionMapping.exception(),
exceptionMapping.result(), actionName);
ExceptionMappingConfig.Builder builder = new ExceptionMappingConfig.Builder(null, exceptionMapping
.exception(), exceptionMapping.result());
@@ -1005,9 +999,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
String actionNamespace, final String actionPackage, final Class<?> actionClass,
Action action) {
if (action != null && !action.value().equals(Action.DEFAULT_VALUE)) {
if (LOG.isTraceEnabled()) {
LOG.trace("Using non-default action namespace from the Action annotation of [#0]", action.value());
}
LOG.trace("Using non-default action namespace from the Action annotation of [{}]", action.value());
String actionName = action.value();
actionNamespace = StringUtils.contains(actionName, "/") ? StringUtils.substringBeforeLast(actionName, "/") : StringUtils.EMPTY;
}
@@ -1016,10 +1008,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
ParentPackage parent = AnnotationUtils.findAnnotation(actionClass, ParentPackage.class);
String parentName = null;
if (parent != null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Using non-default parent package from annotation of [#0]", parent.value());
}
LOG.trace("Using non-default parent package from annotation of [{}]", parent.value());
parentName = parent.value();
}
@@ -1051,14 +1040,11 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
if (defaultInterceptorRef != null) {
pkgConfig.defaultInterceptorRef(defaultInterceptorRef.value());
if (LOG.isTraceEnabled())
LOG.trace("Setting [#0] as the default interceptor ref for [#1]", defaultInterceptorRef.value(), pkgConfig.getName());
LOG.trace("Setting [{}] as the default interceptor ref for [{}]", defaultInterceptorRef.value(), pkgConfig.getName());
}
}
if (LOG.isTraceEnabled()) {
LOG.trace("Created package config named [#0] with a namespace [#1]", name, actionNamespace);
}
LOG.trace("Created package config named [{}] with a namespace [{}]", name, actionNamespace);
return pkgConfig;
}
@@ -1110,18 +1096,16 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
parent.addActionConfig(parentAction, indexActionConfig);
}
} else if (LOG.isTraceEnabled()) {
LOG.trace("The parent namespace [#0] already contains " +
"an action [#1]", parentNamespace, parentAction);
LOG.trace("The parent namespace [{}] already contains " +
"an action [{}]", parentNamespace, parentAction);
}
}
}
// Step #3
if (pkgConfig.build().getAllActionConfigs().get("") == null) {
if (LOG.isTraceEnabled()) {
LOG.trace("Creating index ActionConfig with an action name of [] for the action " +
"class [#0]", indexActionConfig.getClassName());
}
LOG.trace("Creating index ActionConfig with an action name of [] for the action " +
"class [{}]", indexActionConfig.getClassName());
pkgConfig.addActionConfig("", indexActionConfig);
}
@@ -1137,7 +1121,7 @@ public class PackageBasedActionConfigBuilder implements ActionConfigBuilder {
for (String url : loadedFileUrls) {
if (fileManager.fileNeedsReloading(url)) {
if (LOG.isDebugEnabled())
LOG.debug("File [#0] changed, configuration will be reloaded", url);
LOG.debug("File [{}] changed, configuration will be reloaded", url);
return true;
}
}
@@ -89,9 +89,7 @@ public class SEOActionNameBuilder implements ActionNameBuilder {
actionName = actionName.toLowerCase();
}
if (LOG.isTraceEnabled()) {
LOG.trace("Changed action name from [#0] to [#1]", className, actionName);
}
LOG.trace("Changed action name from [{}] to [{}]", className, actionName);
return actionName;
}
@@ -81,9 +81,7 @@ public class JSPLoader {
public Servlet load(String location) throws Exception {
location = StringUtils.substringBeforeLast(location, "?");
if (LOG.isDebugEnabled()) {
LOG.debug("Compiling JSP [#0]", location);
}
LOG.debug("Compiling JSP [{}]", location);
//use Jasper to compile the JSP into java code
JspC jspC = compileJSP(location);
@@ -137,14 +135,10 @@ public class JSPLoader {
* Compiles the given source code into java bytecode
*/
private void compileJava(String className, final String source, Set<String> extraClassPath) throws IOException {
if (LOG.isTraceEnabled())
LOG.trace("Compiling [#0], source: [#1]", className, source);
LOG.trace("Compiling [{}], source: [{}]", className, source);
JavaCompiler compiler =
ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics =
new DiagnosticCollector<JavaFileObject>();
JavaCompiler compiler =ToolProvider.getSystemJavaCompiler();
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
//the generated bytecode is fed to the class loader
JavaFileManager jfm = new
@@ -100,10 +100,7 @@ public class ValueStackDataSource implements JRRewindableDataSource {
}
Object value = valueStack.findValue(expression);
if (LOG.isDebugEnabled()) {
LOG.debug("Field [#0] = [#1]", field.getName(), value);
}
LOG.debug("Field [{}] = [{}]", field.getName(), value);
if (!wrapField && MakeIterator.isIterable(value) && !field.getValueClass().isInstance(value)) {
return value;
@@ -132,9 +129,7 @@ public class ValueStackDataSource implements JRRewindableDataSource {
iterator = MakeIterator.convert(array);
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Data source value for data source [" + dataSource + "] was null");
}
LOG.warn("Data source value for data source [{}] was null", dataSource);
}
}
@@ -156,14 +151,12 @@ public class ValueStackDataSource implements JRRewindableDataSource {
if ((iterator != null) && (iterator.hasNext())) {
valueStack.push(iterator.next());
if (LOG.isDebugEnabled()) {
LOG.debug("Pushed next value: " + valueStack.findValue("."));
LOG.debug("Pushed next value: {}", valueStack.findValue("."));
}
return true;
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("No more values");
}
LOG.debug("No more values");
return false;
}
@@ -93,8 +93,7 @@ public class Java8ClassFinder implements ClassFinder {
}
}
} catch (Exception e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to read URL [#0]", e, location.toExternalForm());
LOG.error("Unable to read URL [{}]", location.toExternalForm(), e);
}
}
@@ -103,8 +102,7 @@ public class Java8ClassFinder implements ClassFinder {
if (classNameFilter.test(className))
readClassDef(className);
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to read class [#0]", e, className);
LOG.error("Unable to read class [{}]", className, e);
}
}
}
@@ -197,8 +195,7 @@ public class Java8ClassFinder implements ClassFinder {
classes.add(clazz);
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -228,8 +225,7 @@ public class Java8ClassFinder implements ClassFinder {
}
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -259,8 +255,7 @@ public class Java8ClassFinder implements ClassFinder {
}
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -290,8 +285,7 @@ public class Java8ClassFinder implements ClassFinder {
}
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -310,8 +304,7 @@ public class Java8ClassFinder implements ClassFinder {
classes.add(classInfo.get());
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -327,8 +320,7 @@ public class Java8ClassFinder implements ClassFinder {
classes.add(classInfo.get());
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -342,8 +334,7 @@ public class Java8ClassFinder implements ClassFinder {
try {
classes.add(classInfo.get());
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -360,8 +351,7 @@ public class Java8ClassFinder implements ClassFinder {
urls.add(url);
}
} catch (IOException ioe) {
if (LOG.isErrorEnabled())
LOG.error("Could not read driectory [#0]", ioe, dirName);
LOG.error("Could not read directory [{}]", dirName, ioe);
}
}
@@ -405,9 +395,9 @@ public class Java8ClassFinder implements ClassFinder {
} finally {
in.close();
}
} else if (LOG.isDebugEnabled())
LOG.debug("Unable to read [#0]", location.toExternalForm());
} else {
LOG.debug("Unable to read [{}]", location.toExternalForm());
}
return Collections.emptyList();
}
@@ -41,8 +41,7 @@ public class DefaultTagHandlerFactory implements TagHandlerFactory {
th.setNext(next);
return th;
} catch (Exception e) {
if (LOG.isErrorEnabled())
LOG.error("Failed to instantiate tag handler class [#0]", e, tagHandlerClass.getName());
LOG.error("Failed to instantiate tag handler class [{}]", tagHandlerClass.getName(), e);
}
return null;
@@ -116,9 +116,7 @@ public class DefaultTheme implements Theme {
TagGenerator gen = (TagGenerator) handlers.get(0);
try {
if (LOG.isTraceEnabled()) {
LOG.trace("Rendering tag [#0]", tagName);
}
LOG.trace("Rendering tag [{}]", tagName);
gen.generate();
} catch (IOException ex) {
throw new StrutsException("Unable to write tag: " + tagName, ex);
@@ -71,9 +71,7 @@ public class JavaTemplateEngine extends BaseTemplateEngine {
Theme theme = themes.get(t.getTheme());
if (theme == null) {
// Theme not supported, so do what struts would have done if we were not here.
if (LOG.isDebugEnabled()) {
LOG.debug("Theme not found [#0] trying default template engine using template type [#1]", t.getTheme(), defaultTemplateType);
}
LOG.debug("Theme not found [{}] trying default template engine using template type [{}]", t.getTheme(), defaultTemplateType);
final TemplateEngine engine = templateEngineManager.getTemplateEngine(templateContext.getTemplate(), defaultTemplateType);
if (engine == null) {
@@ -120,24 +118,16 @@ public class JavaTemplateEngine extends BaseTemplateEngine {
while (customThemes.hasMoreTokens()) {
String themeClass = customThemes.nextToken().trim();
try {
if (LOG.isInfoEnabled()) {
LOG.info("Registering custom theme [#0] to javatemplates engine", themeClass);
}
LOG.info("Registering custom theme [{}] to javatemplates engine", themeClass);
ObjectFactory factory = ActionContext.getContext().getContainer().getInstance(ObjectFactory.class);
Theme theme = (Theme) factory.buildBean(themeClass, new HashMap<String, Object>());
themes.add(theme);
} catch (ClassCastException cce) {
if (LOG.isErrorEnabled()) {
LOG.error("Invalid java them class [#0]. Class does not implement 'org.apache.struts2.views.java.Theme' interface", cce, themeClass);
}
LOG.error("Invalid java them class [{}]. Class does not implement 'org.apache.struts2.views.java.Theme' interface", themeClass, cce);
} catch (ClassNotFoundException cnf) {
if (LOG.isErrorEnabled()) {
LOG.error("Invalid java theme class [#0]. Class not found!", cnf, themeClass);
}
LOG.error("Invalid java theme class [{}]. Class not found!", themeClass, cnf);
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Could not find messages file [#0].properties. Skipping!", e, themeClass);
}
LOG.error("Could not find messages file [{}].properties. Skipping!", themeClass, e);
}
}
}
@@ -152,8 +142,8 @@ public class JavaTemplateEngine extends BaseTemplateEngine {
// Make sure we don't set ourself as default for race condition
if (defaultTemplateTheme != null && !defaultTemplateTheme.equalsIgnoreCase(getSuffix())) {
this.defaultTemplateType = defaultTemplateTheme.toLowerCase();
} else if(LOG.isErrorEnabled()) {
LOG.error("Invalid struts.javatemplates.defaultTemplateType value. Cannot be [#0]!", getSuffix());
} else {
LOG.error("Invalid struts.javatemplates.defaultTemplateType value. Cannot be [{}]!", getSuffix());
}
}
@@ -420,7 +420,7 @@ public class JSONWriter {
Object key = entry.getKey();
if (key == null) {
LOG.error("Cannot build expression for null key in #0", exprStack);
LOG.error("Cannot build expression for null key in {}", exprStack);
continue;
}
@@ -438,7 +438,7 @@ public class JSONWriter {
hasData = true;
if (!warnedNonString && !(key instanceof String)) {
if (LOG.isWarnEnabled()) {
LOG.warn("JavaScript doesn't support non-String keys, using toString() on #0", key.getClass().getName());
LOG.warn("JavaScript doesn't support non-String keys, using toString() on {}", key.getClass().getName());
}
warnedNonString = true;
}
@@ -110,8 +110,7 @@ public class DefaultBundleAccessor implements BundleAccessor {
Bundle bundle = getCurrentBundle();
if (bundle != null) {
Class cls = bundle.loadClass(className);
if (LOG.isTraceEnabled())
LOG.trace("Located class [#0] in bundle [#1]", className, bundle.getSymbolicName());
LOG.trace("Located class [{}] in bundle [{}]", className, bundle.getSymbolicName());
return cls;
}
@@ -115,9 +115,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
*/
protected void loadConfigFromBundle(Bundle bundle) {
String bundleName = bundle.getSymbolicName();
if (LOG.isDebugEnabled()) {
LOG.debug("Loading packages from bundle [#0]", bundleName);
}
LOG.debug("Loading packages from bundle [{}]", bundleName);
//init action context
ActionContext ctx = ActionContext.getContext();
@@ -132,9 +130,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
ctx.put(ClassLoaderInterface.CLASS_LOADER_INTERFACE, new BundleClassLoaderInterface());
ctx.put(BundleAccessor.CURRENT_BUNDLE_NAME, bundleName);
if (LOG.isTraceEnabled()) {
LOG.trace("Loading XML config from bundle [#0]", bundleName);
}
LOG.trace("Loading XML config from bundle [{}]", bundleName);
//XML config
PackageLoader loader = new BundlePackageLoader();
@@ -149,8 +145,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
PackageProvider conventionPackageProvider = configuration.getContainer().getInstance(PackageProvider.class, "convention.packageProvider");
if (conventionPackageProvider != null) {
if (LOG.isTraceEnabled())
LOG.trace("Loading Convention config from bundle [#0]", bundleName);
LOG.trace("Loading Convention config from bundle [{}]", bundleName);
conventionPackageProvider.loadPackages();
}
@@ -235,8 +230,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
if (bundleName != null && shouldProcessBundle(bundle)) {
switch (bundleEvent.getType()) {
case BundleEvent.STARTED:
if (LOG.isTraceEnabled())
LOG.trace("The bundlde [#0] has been activated and will be scanned for struts configuration", bundleName);
LOG.trace("The bundle [{}] has been activated and will be scanned for struts configuration", bundleName);
loadConfigFromBundle(bundle);
break;
case BundleEvent.STOPPED:
@@ -255,7 +249,7 @@ public class OsgiConfigurationProvider implements PackageProvider, BundleListene
Set<String> packages = bundleAccessor.getPackagesByBundle(bundle);
if (!packages.isEmpty()) {
if (LOG.isTraceEnabled()) {
LOG.trace("The bundle [#0] has been stopped. The packages [#1] will be disabled", bundle.getSymbolicName(), StringUtils.join(packages, ","));
LOG.trace("The bundle [{}] has been stopped. The packages [{}] will be disabled", bundle.getSymbolicName(), StringUtils.join(packages, ","));
}
for (String packageName : packages) {
configuration.removePackageConfig(packageName);
@@ -58,8 +58,7 @@ public class OsgiUtil {
Method getBeanMethod = beanFactory.getClass().getMethod("getBean", String.class);
return getBeanMethod.invoke(beanFactory, beanId);
} catch (Exception ex) {
if (LOG.isErrorEnabled())
LOG.error("Unable to call getBean() on object of type [#0], with bean id [#1]", ex, beanFactory.getClass().getName(), beanId);
LOG.error("Unable to call getBean() on object of type [{}], with bean id [{}]", beanFactory.getClass().getName(), beanId, ex);
}
return null;
@@ -74,8 +73,7 @@ public class OsgiUtil {
Method getBeanMethod = beanFactory.getClass().getMethod("containsBean", String.class);
return (Boolean) getBeanMethod.invoke(beanFactory, beanId);
} catch (Exception ex) {
if (LOG.isErrorEnabled())
LOG.error("Unable to call containsBean() on object of type [#0], with bean id [#1]", ex, beanFactory.getClass().getName(), beanId);
LOG.error("Unable to call containsBean() on object of type [{}], with bean id [{}]", beanFactory.getClass().getName(), beanId, ex);
}
return false;
@@ -25,9 +25,8 @@ public class StrutsOsgiListener implements ServletContextListener {
ServletContext servletContext = sce.getServletContext();
String platform = servletContext.getInitParameter(PLATFORM_KEY);
if (LOG.isDebugEnabled()) {
LOG.debug("Defined OSGi platform as [#0] via context-param [#1]", platform, PLATFORM_KEY);
}
LOG.debug("Defined OSGi platform as [{}] via context-param [{}]", platform, PLATFORM_KEY);
osgiHost = OsgiHostFactory.createOsgiHost(platform);
servletContext.setAttribute(OSGI_HOST, osgiHost);
try {
@@ -145,19 +145,17 @@ public abstract class BaseOsgiHost implements OsgiHost {
for (String runLevel : runLevelDirs) {
dirs.put(runLevel, StringUtils.chomp(dir, "/") + "/" + runLevel);
}
} else if (LOG.isDebugEnabled()) {
LOG.debug("No run level directories found under the [#0] directory", dir);
} else {
LOG.debug("No run level directories found under the [{}] directory", dir);
}
} else if (LOG.isWarnEnabled()) {
LOG.warn("Unable to read [#0] directory", dir);
} else {
LOG.warn("Unable to read [{}] directory", dir);
}
} else if (LOG.isWarnEnabled()) {
LOG.warn("The [#0] directory was not found", dir);
} else {
LOG.warn("The [{}] directory was not found", dir);
}
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable load bundles from the [#0] directory", e, dir);
}
LOG.warn("Unable load bundles from the [{}] directory", dir, e);
}
return dirs;
}
@@ -180,25 +178,21 @@ public abstract class BaseOsgiHost implements OsgiHost {
//add all the bundles to the list
for (File bundle : bundles) {
String externalForm = bundle.toURI().toURL().toExternalForm();
if (LOG.isDebugEnabled()) {
LOG.debug("Adding bundle [#0]", externalForm);
}
LOG.debug("Adding bundle [{}]", externalForm);
bundleJars.add(externalForm);
}
} else if (LOG.isDebugEnabled()) {
LOG.debug("No bundles found under the [#0] directory", dir);
} else {
LOG.debug("No bundles found under the [{}] directory", dir);
}
} else if (LOG.isWarnEnabled()) {
LOG.warn("Unable to read [#0] directory", dir);
} else {
LOG.warn("Unable to read [{}] directory", dir);
}
} else if (LOG.isWarnEnabled()) {
LOG.warn("The [#0] directory was not found", dir);
} else {
LOG.warn("The [{}] directory was not found", dir);
}
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable load bundles from the [#0] directory", e, dir);
}
LOG.warn("Unable load bundles from the [{}] directory", dir, e);
}
return bundleJars;
}
@@ -254,9 +248,7 @@ public abstract class BaseOsgiHost implements OsgiHost {
}
}
} catch (IOException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to find subpackages of [#0]", e, rootPackage);
}
LOG.error("Unable to find subpackages of [{}]", rootPackage, e);
}
}
@@ -287,9 +279,7 @@ public abstract class BaseOsgiHost implements OsgiHost {
return getVersionFromString(jarFile.getName());
}
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to extract version from [#0], defaulting to '1.0.0'", url.toExternalForm());
}
LOG.error("Unable to extract version from [{}], defaulting to '1.0.0'", url.toExternalForm());
}
}
return "1.0.0";
@@ -73,13 +73,11 @@ public class FelixOsgiHost extends BaseOsgiHost {
// Bundle cache
String storageDir = System.getProperty("java.io.tmpdir") + ".felix-cache";
configProps.setProperty(Constants.FRAMEWORK_STORAGE, storageDir);
if (LOG.isDebugEnabled())
LOG.debug("Storing bundles at [#0]", storageDir);
LOG.debug("Storing bundles at [{}]", storageDir);
String cleanBundleCache = getServletContextParam("struts.osgi.clearBundleCache", "true");
if ("true".equalsIgnoreCase(cleanBundleCache)) {
if (LOG.isDebugEnabled())
LOG.debug("Clearing bundle cache");
LOG.debug("Clearing bundle cache");
configProps.put(FelixConstants.FRAMEWORK_STORAGE_CLEAN, FelixConstants.FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT);
}
@@ -95,9 +93,7 @@ public class FelixOsgiHost extends BaseOsgiHost {
AutoProcessor.process(configProps, felix.getBundleContext());
felix.start();
if (LOG.isTraceEnabled()) {
LOG.trace("Apache Felix is running");
}
LOG.trace("Apache Felix is running");
}
catch (Exception ex) {
throw new ConfigurationException("Couldn't start Apache Felix", ex);
@@ -144,9 +140,7 @@ public class FelixOsgiHost extends BaseOsgiHost {
@Override
public void destroy() throws Exception {
felix.stop();
if (LOG.isTraceEnabled()) {
LOG.trace("Apache Felix has stopped");
}
LOG.trace("Apache Felix has stopped");
}
@Override
@@ -163,11 +157,8 @@ public class FelixOsgiHost extends BaseOsgiHost {
LOG.debug("Spring OSGi support is not enabled");
}
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("The API of Spring OSGi has changed and the field [#0] is no longer available. The OSGi plugin needs to be updated", e,
"org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE");
}
LOG.error("The API of Spring OSGi has changed and the field [{}] is no longer available. The OSGi plugin needs to be updated",
"org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE", e);
}
}
}
@@ -138,12 +138,9 @@ public class GlassfishOSGiHost extends BaseOsgiHost implements OsgiHost {
LOG.debug("Spring OSGi support is not enabled");
}
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error(
"The API of Spring OSGi has changed and the field [#0] is no longer available. The OSGi plugin needs to be updated",
e,
"org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE");
}
LOG.error(
"The API of Spring OSGi has changed and the field [[}] is no longer available. The OSGi plugin needs to be updated",
"org.springframework.osgi.web.context.support.OsgiBundleXmlWebApplicationContext.BUNDLE_CONTEXT_ATTRIBUTE", e);
}
}
@@ -158,9 +158,7 @@ public class DefaultOValValidationManager implements OValValidationManager {
is = fileManager.loadFile(fileUrl);
if (is != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Loading validation xml file [#0]", fileName);
}
LOG.debug("Loading validation xml file [{}]", fileName);
XMLConfigurer configurer = new XMLConfigurer();
configurer.fromXML(is);
validatorFileCache.put(fileName, configurer);
@@ -171,7 +169,7 @@ public class DefaultOValValidationManager implements OValValidationManager {
try {
is.close();
} catch (java.io.IOException e) {
LOG.error("Unable to close input stream for [#0] ", e, fileName);
LOG.error("Unable to close input stream for [{}] ", fileName, e);
}
}
}
@@ -100,7 +100,7 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
String context = proxy.getConfig().getName();
if (LOG.isDebugEnabled()) {
LOG.debug("Validating [#0/#1] with method [#2]", invocation.getProxy().getNamespace(), invocation.getProxy().getActionName(), methodName);
LOG.debug("Validating [{}/{}] with method [{}]", invocation.getProxy().getNamespace(), invocation.getProxy().getActionName(), methodName);
}
//OVal vallidatio (no XML yet)
@@ -118,9 +118,7 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
Exception exception = null;
Validateable validateable = (Validateable) action;
if (LOG.isDebugEnabled()) {
LOG.debug("Invoking validate() on action [#0]", validateable.toString());
}
LOG.debug("Invoking validate() on action [{}]", validateable);
try {
PrefixMethodInvocationUtil.invokePrefixMethod(
@@ -129,9 +127,7 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
} catch (Exception e) {
// If any exception occurred while doing reflection, we want
// validate() to be executed
if (LOG.isWarnEnabled()) {
LOG.warn("An exception occured while executing the prefix method", e);
}
LOG.warn("An exception occurred while executing the prefix method", e);
exception = e;
}
@@ -160,9 +156,7 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
String[] profileNames = profiles.value();
if (profileNames != null && profileNames.length > 0) {
validator.disableAllProfiles();
if (LOG.isDebugEnabled()) {
LOG.debug("Enabling profiles [#0]", StringUtils.join(profileNames, ","));
}
LOG.debug("Enabling profiles [{}]", StringUtils.join(profileNames, ","));
for (String profileName : profileNames)
validator.enableProfile(profileName);
}
@@ -194,9 +188,7 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
}
if (isActionError(violation)) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding action error '#0'", message);
}
LOG.debug("Adding action error '{}'", message);
validatorContext.addActionError(message);
} else {
ValidationError validationError = buildValidationError(violation, message);
@@ -207,9 +199,7 @@ public class OValValidationInterceptor extends MethodFilterInterceptor {
fieldName = parentFieldname + "." + fieldName;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Adding field error [#0] with message '#1'", fieldName, validationError.getMessage());
}
LOG.debug("Adding field error [{}] with message '{}'", fieldName, validationError.getMessage());
validatorContext.addFieldError(fieldName, validationError.getMessage());
// don't add "model." prefix to fields of model in model driven action
@@ -181,9 +181,7 @@ public class PellMultiPartRequest implements MultiPartRequest {
}
if ((currentFile != null) && currentFile.isFile()) {
if (!currentFile.delete()) {
if (LOG.isWarnEnabled()) {
LOG.warn("Resource Leaking: Could not remove uploaded file [#0]", currentFile.getAbsolutePath());
}
LOG.warn("Resource Leaking: Could not remove uploaded file [{}]", currentFile.getAbsolutePath());
}
}
}
@@ -109,9 +109,7 @@ public class ClassReloadingXMLWebApplicationContext extends XmlWebApplicationCon
classLoader.addResourceStore(new JarResourceStore(file));
//register with the fam
fam.addListener(file, this);
if (LOG.isDebugEnabled()) {
LOG.debug("Watching [#0] for changes", file.getAbsolutePath());
}
LOG.debug("Watching [{}] for changes", file.getAbsolutePath());
} else {
//get all subdirs
List<File> dirs = new ArrayList<File>();
@@ -122,9 +120,7 @@ public class ClassReloadingXMLWebApplicationContext extends XmlWebApplicationCon
for (File dir : dirs) {
//register with the fam
fam.addListener(dir, this);
if (LOG.isDebugEnabled()) {
LOG.debug("Watching [#0] for changes", dir.getAbsolutePath());
}
LOG.debug("Watching [{}] for changes", dir.getAbsolutePath());
}
}
}
@@ -206,12 +202,10 @@ public class ClassReloadingXMLWebApplicationContext extends XmlWebApplicationCon
private void reload(File file) {
if (classLoader != null) {
final boolean debugEnabled = LOG.isDebugEnabled();
if (debugEnabled)
LOG.debug("Change detected in file [#0], reloading class loader", file.getAbsolutePath());
LOG.debug("Change detected in file [{}], reloading class loader", file.getAbsolutePath());
classLoader.reload();
if (reloadConfig && Dispatcher.getInstance() != null) {
if (debugEnabled)
LOG.debug("Change detected in file [#0], reloading configuration", file.getAbsolutePath());
LOG.debug("Change detected in file [{}], reloading configuration", file.getAbsolutePath());
Dispatcher.getInstance().getConfigurationManager().reload();
}
}
@@ -198,9 +198,7 @@ public class DefaultActionInvocation implements ActionInvocation {
try {
resultConfig = results.get(resultCode);
} catch (NullPointerException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got NPE trying to read result configuration for resultCode [#0]", resultCode);
}
LOG.debug("Got NPE trying to read result configuration for resultCode [{}]", resultCode);
}
if (resultConfig == null) {
@@ -212,9 +210,7 @@ public class DefaultActionInvocation implements ActionInvocation {
try {
return objectFactory.buildResult(resultConfig, invocationContext.getContextMap());
} catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("There was an exception while instantiating the result of type #0", e, resultConfig.getClassName());
}
LOG.error("There was an exception while instantiating the result of type {}", resultConfig.getClassName(), e);
throw new XWorkException(e, resultConfig);
}
} else if (resultCode != null && !Action.NONE.equals(resultCode) && unknownHandlerManager.hasUnknownHandlers()) {
@@ -409,9 +405,7 @@ public class DefaultActionInvocation implements ActionInvocation {
protected String invokeAction(Object action, ActionConfig actionConfig) throws Exception {
String methodName = proxy.getMethod();
if (LOG.isDebugEnabled()) {
LOG.debug("Executing action method = #0", methodName);
}
LOG.debug("Executing action method = {}", methodName);
String timerKey = "invokeAction: " + proxy.getActionName();
try {
@@ -76,9 +76,7 @@ public class DefaultActionProxy implements ActionProxy, Serializable {
this.invocation = inv;
this.cleanupContext = cleanupContext;
if (LOG.isDebugEnabled()) {
LOG.debug("Creating an DefaultActionProxy for namespace [#0] and action name [#1]", namespace, actionName);
}
LOG.debug("Creating an DefaultActionProxy for namespace [{}] and action name [{}]", namespace, actionName);
this.actionName = StringEscapeUtils.escapeHtml4(actionName);
this.namespace = namespace;
@@ -149,9 +149,7 @@ public class ConfigurationManager {
try {
containerProvider.destroy();
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Error while destroying container provider [#0]", e, containerProvider.toString());
}
LOG.warn("Error while destroying container provider [{}]", containerProvider.toString(), e);
}
}
@@ -172,9 +170,7 @@ public class ConfigurationManager {
*/
public synchronized void conditionalReload() {
if (reloadConfigs || providersChanged) {
if (LOG.isDebugEnabled()) {
LOG.debug("Checking ConfigurationProviders for reload.");
}
LOG.debug("Checking ConfigurationProviders for reload.");
List<ContainerProvider> providers = getContainerProviders();
boolean reload = needReloadContainerProviders(providers);
if (!reload) {
@@ -191,7 +187,7 @@ public class ConfigurationManager {
private void updateReloadConfigsFlag() {
reloadConfigs = Boolean.parseBoolean(configuration.getContainer().getInstance(String.class, XWorkConstants.RELOAD_XML_CONFIGURATION));
if (LOG.isDebugEnabled()) {
LOG.debug("Updating [#0], current value is [#1], new value [#2]",
LOG.debug("Updating [{}], current value is [{}], new value [{}]",
XWorkConstants.RELOAD_XML_CONFIGURATION, String.valueOf(reloadConfigs), String.valueOf(reloadConfigs));
}
}
@@ -200,9 +196,7 @@ public class ConfigurationManager {
if (packageProviders != null) {
for (PackageProvider provider : packageProviders) {
if (provider.needsReload()) {
if (LOG.isInfoEnabled()) {
LOG.info("Detected package provider [#0] needs to be reloaded. Reloading all providers.", provider.toString());
}
LOG.info("Detected package provider [{}] needs to be reloaded. Reloading all providers.", provider);
return true;
}
}
@@ -213,9 +207,7 @@ public class ConfigurationManager {
private boolean needReloadContainerProviders(List<ContainerProvider> providers) {
for (ContainerProvider provider : providers) {
if (provider.needsReload()) {
if (LOG.isInfoEnabled()) {
LOG.info("Detected container provider [#0] needs to be reloaded. Reloading all providers.", provider.toString());
}
LOG.info("Detected container provider [{}] needs to be reloaded. Reloading all providers.", provider);
return true;
}
}
@@ -227,9 +219,7 @@ public class ConfigurationManager {
try {
containerProvider.destroy();
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("error while destroying configuration provider [#0]", e, containerProvider.toString());
}
LOG.warn("error while destroying configuration provider [{}]", containerProvider, e);
}
}
packageProviders = this.configuration.reloadContainer(providers);
@@ -70,11 +70,9 @@ public class InterceptorBuilder {
inter = objectFactory.buildInterceptor(config, refParams);
result.add(new InterceptorMapping(refName, inter));
} catch (ConfigurationException ex) {
if (LOG.isWarnEnabled()) {
LOG.warn("Unable to load config class #0 at #1 probably due to a missing jar, which might be fine if you never plan to use the #2 interceptor",
config.getClassName(), ex.getLocation().toString(), config.getName());
}
LOG.error("Actual exception", ex);
LOG.warn("Unable to load config class {} at {} probably due to a missing jar, which might be fine if you never plan to use the {} interceptor",
config.getClassName(), ex.getLocation(), config.getName());
LOG.error("Unable to load config class {}", config.getClassName(), ex);
}
} else if (referencedConfig instanceof InterceptorStackConfig) {
@@ -87,7 +85,7 @@ public class InterceptorBuilder {
}
} else {
LOG.error("Got unexpected type for interceptor " + refName + ". Got " + referencedConfig);
LOG.error("Got unexpected type for interceptor {}. Got {}", refName, referencedConfig);
}
}
@@ -148,9 +146,7 @@ public class InterceptorBuilder {
params.put(name, map);
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("No interceptor found for name = #0", key);
}
LOG.warn("No interceptor found for name = {}", key);
}
}
@@ -246,9 +246,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
if (!optional) {
throw new ConfigurationException("Unable to load bean: type:" + type + " class:" + impl, ex, childNode);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to load optional class: #0", impl);
}
LOG.debug("Unable to load optional class: {}", impl);
}
}
} else if ("constant".equals(nodeName)) {
@@ -427,9 +425,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
} else {
if (!verifyAction(className, name, location)) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to verify action [#0] with class [#1], from [#2]", name, className, location);
}
LOG.error("Unable to verify action [{}] with class [{}], from [{}]", name, className, location);
return;
}
}
@@ -465,10 +461,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
protected boolean verifyAction(String className, String name, Location loc) {
if (className.indexOf('{') > -1) {
if (LOG.isDebugEnabled()) {
LOG.debug("Action class [" + className + "] contains a wildcard " +
"replacement value, so it can't be verified");
}
LOG.debug("Action class [{}] contains a wildcard replacement value, so it can't be verified", className);
return true;
}
try {
@@ -480,28 +473,18 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
clazz.getConstructor(new Class[]{});
}
} catch (ClassNotFoundException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Class not found for action [#0]", e, className);
}
LOG.debug("Class not found for action [{}]", className, e);
throw new ConfigurationException("Action class [" + className + "] not found", loc);
} catch (NoSuchMethodException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("No constructor found for action [#0]", e, className);
}
LOG.debug("No constructor found for action [{}]", className, e);
throw new ConfigurationException("Action class [" + className + "] does not have a public no-arg constructor", e, loc);
} catch (RuntimeException ex) {
// Probably not a big deal, like request or session-scoped Spring 2 beans that need a real request
if (LOG.isInfoEnabled()) {
LOG.info("Unable to verify action class [#0] exists at initialization", className);
}
if (LOG.isDebugEnabled()) {
LOG.debug("Action verification cause", ex);
}
LOG.info("Unable to verify action class [{}] exists at initialization", className);
LOG.debug("Action verification cause", ex);
} catch (Exception ex) {
// Default to failing fast
if (LOG.isDebugEnabled()) {
LOG.debug("Unable to verify action class [#0]", ex, className);
}
LOG.debug("Unable to verify action class [{}]", className, ex);
throw new ConfigurationException(ex, loc);
}
return true;
@@ -514,9 +497,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
String packageName = packageElement.getAttribute("name");
PackageConfig packageConfig = configuration.getPackageConfig(packageName);
if (packageConfig != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Package [#0] already loaded, skipping re-loading it and using existing PackageConfig [#1]", packageName, packageConfig);
}
LOG.debug("Package [{}] already loaded, skipping re-loading it and using existing PackageConfig [{}]", packageName, packageConfig);
return packageConfig;
}
@@ -526,9 +507,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
return newPackage.build();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Loaded " + newPackage);
}
LOG.debug("Loaded {}", newPackage);
// add result types (and default result) to this package
addResultTypes(newPackage, packageElement);
@@ -581,9 +560,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
try {
paramName = (String) clazz.getField("DEFAULT_PARAM").get(null);
} catch (Throwable t) {
if (LOG.isDebugEnabled()) {
LOG.debug("The result type [#0] doesn't have a default param [DEFAULT_PARAM] defined!", t, className);
}
LOG.debug("The result type [{}] doesn't have a default param [DEFAULT_PARAM] defined!", className, t);
}
ResultTypeConfig.Builder resultType = new ResultTypeConfig.Builder(name, className).defaultResultParam(paramName)
.location(DomHelper.getLocationObject(resultTypeElement));
@@ -607,13 +584,9 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
try {
return objectFactory.getClassInstance(className);
} catch (ClassNotFoundException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Result class [#0] doesn't exist (ClassNotFoundException) at #1, ignoring", e, className, loc.toString());
}
LOG.warn("Result class [{}] doesn't exist (ClassNotFoundException) at {}, ignoring", className, loc, e);
} catch (NoClassDefFoundError e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Result class [#0] doesn't exist (NoClassDefFoundError) at #1, ignoring", e, className, loc.toString());
}
LOG.warn("Result class [{}] doesn't exist (NoClassDefFoundError) at {}, ignoring", className, loc, e);
}
return null;
@@ -758,9 +731,7 @@ public class XmlConfigurationProvider implements ConfigurationProvider {
resultParams.put(paramName, val);
}
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("No default parameter defined for result [#0] of type [#1] ", config.getName(), config.getClassName());
}
LOG.warn("No default parameter defined for result [{}] of type [{}] ", config.getName(), config.getClassName());
}
}
}
@@ -35,7 +35,7 @@ public class DefaultConversionAnnotationProcessor implements ConversionAnnotatio
public void process(Map<String, Object> mapping, TypeConversion tc, String key) {
if (LOG.isDebugEnabled()) {
LOG.debug("TypeConversion [#0] with key: [#1]", tc.converter(), key);
LOG.debug("TypeConversion [{}] with key: [{}]", tc.converter(), key);
}
if (key == null) {
return;
@@ -54,9 +54,7 @@ public class DefaultConversionAnnotationProcessor implements ConversionAnnotatio
//for keys of Maps
else if (tc.rule() == ConversionRule.KEY) {
Class converterClass = Thread.currentThread().getContextClassLoader().loadClass(tc.converter());
if (LOG.isDebugEnabled()) {
LOG.debug("Converter class: [#0]", converterClass);
}
LOG.debug("Converter class: [{}]", converterClass);
//check if the converter is a type converter if it is one
//then just put it in the map as is. Otherwise
//put a value in for the type converter of the class
@@ -65,7 +63,7 @@ public class DefaultConversionAnnotationProcessor implements ConversionAnnotatio
} else {
mapping.put(key, converterClass);
if (LOG.isDebugEnabled()) {
LOG.debug("Object placed in mapping for key [#0] is [#1]", key, mapping.get(key));
LOG.debug("Object placed in mapping for key [{}] is [{}]", key, mapping.get(key));
}
}
}
@@ -75,9 +73,7 @@ public class DefaultConversionAnnotationProcessor implements ConversionAnnotatio
}
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception for #0", e, key);
}
LOG.debug("Got exception for {}", key, e);
}
}
@@ -40,7 +40,7 @@ public class DefaultConversionFileProcessor implements ConversionFileProcessor {
if (is != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing conversion file [#0] for class [#1]", converterFilename, clazz);
LOG.debug("Processing conversion file [{}] for class [{}]", converterFilename, clazz);
}
Properties prop = new Properties();
@@ -55,9 +55,7 @@ public class DefaultConversionFileProcessor implements ConversionFileProcessor {
// for keyProperty of Set
if (key.startsWith(DefaultObjectTypeDeterminer.KEY_PROPERTY_PREFIX)
|| key.startsWith(DefaultObjectTypeDeterminer.CREATE_IF_NULL_PREFIX)) {
if (LOG.isDebugEnabled()) {
LOG.debug("\t" + key + ":" + entry.getValue() + "[treated as String]");
}
LOG.debug("\t{}:{} [treated as String]", key, entry.getValue());
mapping.put(key, entry.getValue());
}
//for properties of classes
@@ -66,9 +64,7 @@ public class DefaultConversionFileProcessor implements ConversionFileProcessor {
key.startsWith(DefaultObjectTypeDeterminer.DEPRECATED_ELEMENT_PREFIX))
) {
TypeConverter _typeConverter = converterCreator.createTypeConverter((String) entry.getValue());
if (LOG.isDebugEnabled()) {
LOG.debug("\t" + key + ":" + entry.getValue() + "[treated as TypeConverter " + _typeConverter + "]");
}
LOG.debug("\t{}:{} [treated as TypeConverter {}]", key, entry.getValue(), _typeConverter);
mapping.put(key, _typeConverter);
}
//for keys of Maps
@@ -81,31 +77,23 @@ public class DefaultConversionFileProcessor implements ConversionFileProcessor {
//put a value in for the type converter of the class
if (converterClass.isAssignableFrom(TypeConverter.class)) {
TypeConverter _typeConverter = converterCreator.createTypeConverter((String) entry.getValue());
if (LOG.isDebugEnabled()) {
LOG.debug("\t" + key + ":" + entry.getValue() + "[treated as TypeConverter " + _typeConverter + "]");
}
LOG.debug("\t{}:{} [treated as TypeConverter {}]", key, entry.getValue(), _typeConverter);
mapping.put(key, _typeConverter);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("\t" + key + ":" + entry.getValue() + "[treated as Class " + converterClass + "]");
}
LOG.debug("\t{}:{} [treated as Class {}]", key, entry.getValue(), converterClass);
mapping.put(key, converterClass);
}
}
//elements(values) of maps / lists
else {
Class _c = Thread.currentThread().getContextClassLoader().loadClass((String) entry.getValue());
if (LOG.isDebugEnabled()) {
LOG.debug("\t" + key + ":" + entry.getValue() + "[treated as Class " + _c + "]");
}
LOG.debug("\t{}:{} [treated as Class {}]", key, entry.getValue(), _c);
mapping.put(key, _c);
}
}
}
} catch (Exception ex) {
if (LOG.isErrorEnabled()) {
LOG.error("Problem loading properties for #0", ex, clazz.getName());
}
LOG.error("Problem loading properties for {}", clazz.getName(), ex);
}
}
@@ -52,9 +52,7 @@ public class DefaultConversionPropertiesProcessor implements ConversionPropertie
Properties props = new Properties();
props.load(url.openStream());
if (LOG.isDebugEnabled()) {
LOG.debug("processing conversion file [" + propsName + "]");
}
LOG.debug("Processing conversion file [{}]", propsName);
for (Object o : props.entrySet()) {
Map.Entry entry = (Map.Entry) o;
@@ -63,7 +61,7 @@ public class DefaultConversionPropertiesProcessor implements ConversionPropertie
try {
TypeConverter _typeConverter = converterCreator.createTypeConverter((String) entry.getValue());
if (LOG.isDebugEnabled()) {
LOG.debug("\t" + key + ":" + entry.getValue() + " [treated as TypeConverter " + _typeConverter + "]");
LOG.debug("\t{}:{} [treated as TypeConverter {}]", key, entry.getValue(), _typeConverter);
}
converterHolder.addDefaultMapping(key, _typeConverter);
} catch (Exception e) {
@@ -75,9 +73,7 @@ public class DefaultConversionPropertiesProcessor implements ConversionPropertie
if (require) {
throw new XWorkException("Cannot load conversion properties file: "+propsName, ex);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot load conversion properties file: #0", ex, propsName);
}
LOG.debug("Cannot load conversion properties file: {}", propsName, ex);
}
}
}
@@ -299,9 +299,7 @@ public class DefaultObjectTypeDeterminer implements ObjectTypeDeterminer {
return (Class) resultType;
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Error while retrieving generic property class for property = #0", e, property);
}
LOG.debug("Error while retrieving generic property class for property: {}", property, e);
}
return null;
}
@@ -313,8 +313,7 @@ public class XWorkConverter extends DefaultTypeConverter {
try {
return tc.convertValue(context, target, member, property, value, toClass);
} catch (Exception e) {
if (LOG.isDebugEnabled())
LOG.debug("unable to convert value using type converter [#0]", e, tc.getClass().getName());
LOG.debug("Unable to convert value using type converter [{}]", tc.getClass().getName(), e);
handleConversionException(context, property, value, target);
return TypeConverter.NO_CONVERSION_POSSIBLE;
@@ -323,24 +322,20 @@ public class XWorkConverter extends DefaultTypeConverter {
if (defaultTypeConverter != null) {
try {
if (LOG.isDebugEnabled())
LOG.debug("falling back to default type converter [" + defaultTypeConverter + "]");
LOG.debug("Falling back to default type converter [{}]", defaultTypeConverter);
return defaultTypeConverter.convertValue(context, target, member, property, value, toClass);
} catch (Exception e) {
if (LOG.isDebugEnabled())
LOG.debug("unable to convert value using type converter [#0]", e, defaultTypeConverter.getClass().getName());
LOG.debug("Unable to convert value using type converter [{}]", defaultTypeConverter.getClass().getName(), e);
handleConversionException(context, property, value, target);
return TypeConverter.NO_CONVERSION_POSSIBLE;
}
} else {
try {
if (LOG.isDebugEnabled())
LOG.debug("falling back to Ognl's default type conversion");
LOG.debug("Falling back to Ognl's default type conversion");
return super.convertValue(value, toClass);
} catch (Exception e) {
if (LOG.isDebugEnabled())
LOG.debug("unable to convert value using type converter [#0]", e, super.getClass().getName());
LOG.debug("Unable to convert value using type converter [{}]", super.getClass().getName(), e);
handleConversionException(context, property, value, target);
return TypeConverter.NO_CONVERSION_POSSIBLE;
@@ -368,9 +363,7 @@ public class XWorkConverter extends DefaultTypeConverter {
try {
clazz = Thread.currentThread().getContextClassLoader().loadClass(className);
} catch (ClassNotFoundException cnfe) {
if (LOG.isDebugEnabled()) {
LOG.debug("Cannot load class #0", cnfe, className);
}
LOG.debug("Cannot load class {}", className, cnfe);
}
result = lookupSuper(clazz);
@@ -408,9 +401,8 @@ public class XWorkConverter extends DefaultTypeConverter {
}
protected Object getConverter(Class clazz, String property) {
if (LOG.isDebugEnabled()) {
LOG.debug("Retrieving convert for class [#0] and property [#1]", clazz, property);
}
LOG.debug("Retrieving convert for class [{}] and property [{}]", clazz, property);
synchronized (clazz) {
if ((property != null) && !converterHolder.containsNoMapping(clazz)) {
try {
@@ -423,17 +415,15 @@ public class XWorkConverter extends DefaultTypeConverter {
}
Object converter = mapping.get(property);
if (LOG.isDebugEnabled() && converter == null) {
LOG.debug("Converter is null for property [#0]. Mapping size [#1]:", property, mapping.size());
if (converter == null && LOG.isDebugEnabled()) {
LOG.debug("Converter is null for property [{}]. Mapping size [{}]:", property, mapping.size());
for (String next : mapping.keySet()) {
LOG.debug(next + ":" + mapping.get(next));
LOG.debug("{}:{}", next, mapping.get(next));
}
}
return converter;
} catch (Throwable t) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception trying to resolve convert for class [#0] and property [#1]", t, clazz, property);
}
LOG.debug("Got exception trying to resolve convert for class [{}] and property [{}]", clazz, property, t);
converterHolder.addNoMapping(clazz);
}
}
@@ -499,9 +489,9 @@ public class XWorkConverter extends DefaultTypeConverter {
}
if (LOG.isDebugEnabled()) {
if (StringUtils.isEmpty(tc.key())) {
LOG.debug("WARNING! key of @TypeConversion [#0] applied to [#1] is empty!", tc.converter(), clazz.getName());
LOG.debug("WARNING! key of @TypeConversion [{}] applied to [{}] is empty!", tc.converter(), clazz.getName());
} else {
LOG.debug("TypeConversion [#0] with key: [#1]", tc.converter(), tc.key());
LOG.debug("TypeConversion [{}] with key: [{}]", tc.converter(), tc.key());
}
}
annotationProcessor.process(mapping, tc, tc.key());
@@ -522,9 +512,7 @@ public class XWorkConverter extends DefaultTypeConverter {
// Default to the property name
if (StringUtils.isEmpty(key)) {
key = AnnotationUtils.resolvePropertyName(method);
if (LOG.isDebugEnabled()) {
LOG.debug("Retrieved key [#0] from method name [#1]", key, method.getName());
}
LOG.debug("Retrieved key [{}] from method name [{}]", key, method.getName());
}
annotationProcessor.process(mapping, tc, key);
}
@@ -23,9 +23,7 @@ public class DefaultConverterFactory implements ConverterFactory {
}
public TypeConverter buildConverter(Class<? extends TypeConverter> converterClass, Map<String, Object> extraContext) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("Creating converter of type [#0]", converterClass.getCanonicalName());
}
LOG.debug("Creating converter of type [{}]", converterClass.getCanonicalName());
return container.getInstance(converterClass);
}
@@ -151,9 +151,7 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
ValidationAware validationAwareAction = (ValidationAware) action;
if (validationAwareAction.hasErrors()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Errors on action [#0], returning result name [#1]", validationAwareAction, inputResultName);
}
LOG.debug("Errors on action [{}], returning result name [{}]", validationAwareAction, inputResultName);
String resultName = inputResultName;
resultName = processValidationWorkflowAware(action, resultName);
@@ -174,10 +172,8 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
String resultName = currentResultName;
if (action instanceof ValidationWorkflowAware) {
resultName = ((ValidationWorkflowAware) action).getInputResultName();
if (LOG.isDebugEnabled()) {
LOG.debug("Changing result name from [#0] to [#1] because of processing [#2] interface applied to [#3]",
LOG.debug("Changing result name from [{}] to [{}] because of processing [{}] interface applied to [{}]",
currentResultName, resultName, InputConfig.class.getSimpleName(), ValidationWorkflowAware.class.getSimpleName(), action);
}
}
return resultName;
}
@@ -195,10 +191,8 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
} else {
resultName = annotation.resultName();
}
if (LOG.isDebugEnabled()) {
LOG.debug("Changing result name from [#0] to [#1] because of processing annotation [#2] on action [#3]",
LOG.debug("Changing result name from [{}] to [{}] because of processing annotation [{}] on action [{}]",
currentResultName, resultName, InputConfig.class.getSimpleName(), action);
}
}
return resultName;
}
@@ -210,10 +204,8 @@ public class DefaultWorkflowInterceptor extends MethodFilterInterceptor {
String resultName = currentResultName;
if (action instanceof ValidationErrorAware) {
resultName = ((ValidationErrorAware) action).actionErrorOccurred(currentResultName);
if (LOG.isDebugEnabled()) {
LOG.debug("Changing result name from [#0] to [#1] because of processing interface [#2] on action [#3]",
LOG.debug("Changing result name from [{}] to [{}] because of processing interface [{}] on action [{}]",
currentResultName, resultName, ValidationErrorAware.class.getSimpleName(), action);
}
}
return resultName;
}
@@ -123,7 +123,7 @@ public class I18nInterceptor extends AbstractInterceptor {
@Override
public String intercept(ActionInvocation invocation) throws Exception {
if (LOG.isDebugEnabled()) {
LOG.debug("intercept '#0/#1' {",
LOG.debug("Intercept '{}/{}' {",
invocation.getProxy().getNamespace(), invocation.getProxy().getActionName());
}
@@ -133,13 +133,13 @@ public class I18nInterceptor extends AbstractInterceptor {
saveLocale(invocation, locale);
if (LOG.isDebugEnabled()) {
LOG.debug("before Locale=#0", invocation.getStack().findValue("locale"));
LOG.debug("before Locale: {}", invocation.getStack().findValue("locale"));
}
final String result = invocation.invoke();
if (LOG.isDebugEnabled()) {
LOG.debug("after Locale=#0", invocation.getStack().findValue("locale"));
LOG.debug("after Locale {}", invocation.getStack().findValue("locale"));
LOG.debug("intercept } ");
}
@@ -222,8 +222,8 @@ public class I18nInterceptor extends AbstractInterceptor {
locale = (requestedLocale instanceof Locale) ?
(Locale) requestedLocale :
LocalizedTextUtil.localeFromString(requestedLocale.toString(), null);
if (locale != null && LOG.isDebugEnabled()) {
LOG.debug("applied request locale=#0", locale);
if (locale != null) {
LOG.debug("Applied request locale: {}", locale);
}
}
return locale;
@@ -252,9 +252,7 @@ public class I18nInterceptor extends AbstractInterceptor {
Object sessionLocale = session.get(attributeName);
if (sessionLocale != null && sessionLocale instanceof Locale) {
Locale locale = (Locale) sessionLocale;
if (LOG.isDebugEnabled()) {
LOG.debug("applied session locale=#0", locale);
}
LOG.debug("Applied session locale: {}", locale);
return locale;
}
return null;
@@ -263,8 +261,8 @@ public class I18nInterceptor extends AbstractInterceptor {
protected Locale readStoredLocalFromCurrentInvocation(ActionInvocation invocation) {
// no overriding locale definition found, stay with current invocation (=browser) locale
Locale locale = invocation.getInvocationContext().getLocale();
if (locale != null && LOG.isDebugEnabled()) {
LOG.debug("applied invocation context locale=#0", locale);
if (locale != null) {
LOG.debug("Applied invocation context locale: {}", locale);
}
return locale;
}
@@ -275,9 +273,7 @@ public class I18nInterceptor extends AbstractInterceptor {
&& ((Object[]) requestedLocale).length > 0) {
requestedLocale = ((Object[]) requestedLocale)[0];
if (LOG.isDebugEnabled()) {
LOG.debug("requested_locale=#0", requestedLocale);
}
LOG.debug("Requested locale: {}", requestedLocale);
}
return requestedLocale;
}
@@ -412,7 +412,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
protected boolean acceptableName(String name) {
boolean accepted = isWithinLengthLimit(name) && !isExcluded(name) && isAccepted(name);
if (devMode && accepted) { // notify only when in devMode
LOG.debug("Parameter [#0] was accepted and will be appended to action!", name);
LOG.debug("Parameter [{}] was accepted and will be appended to action!", name);
}
return accepted;
}
@@ -420,7 +420,7 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
protected boolean isWithinLengthLimit( String name ) {
boolean matchLength = name.length() <= paramNameMaxLength;
if (!matchLength) {
notifyDeveloper("Parameter [#0] is too long, allowed length is [#1]", name, String.valueOf(paramNameMaxLength));
notifyDeveloper("Parameter [{}] is too long, allowed length is [{}]", name, String.valueOf(paramNameMaxLength));
}
return matchLength;
}
@@ -430,14 +430,14 @@ public class ParametersInterceptor extends MethodFilterInterceptor {
if (result.isAccepted()) {
return true;
}
notifyDeveloper("Parameter [#0] didn't match accepted pattern [#1]!", paramName, result.getAcceptedPattern());
notifyDeveloper("Parameter [{}] didn't match accepted pattern [{}]!", paramName, result.getAcceptedPattern());
return false;
}
protected boolean isExcluded(String paramName) {
ExcludedPatternsChecker.IsExcluded result = excludedPatterns.isExcluded(paramName);
if (result.isExcluded()) {
notifyDeveloper("Parameter [#0] matches excluded pattern [#1]!", paramName, result.getExcludedPattern());
notifyDeveloper("Parameter [{}] matches excluded pattern [{}]!", paramName, result.getExcludedPattern());
return true;
}
return false;
@@ -146,9 +146,7 @@ public class PrefixMethodInvocationUtil {
}
catch (NoSuchMethodException e) {
// hmm -- OK, try next prefix
if (LOG.isDebugEnabled()) {
LOG.debug("cannot find method [#0] in action [#1]", prefixedMethodName, action.toString());
}
LOG.debug("Cannot find method [{}] in action [{}]", prefixedMethodName, action.toString());
}
}
return null;
@@ -199,9 +199,7 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS
.build();
throw new XWorkException(message, re);
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Error setting value [#0] with expression [#1]", re, value.toString(), expr);
}
LOG.warn("Error setting value [{}] with expression [{}]", value, expr, re);
}
}
@@ -333,7 +331,7 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS
Object ret = findInContext(expr);
if (ret == null) {
if (shouldLogMissingPropertyWarning(e)) {
LOG.warn("Could not find property [#0]!", e, expr);
LOG.warn("Could not find property [{}]!", expr, e);
}
if (throwExceptionOnFailure) {
throw new XWorkException(e);
@@ -381,12 +379,11 @@ public class OgnlValueStack implements Serializable, ValueStack, ClearableValueS
* @param e The thrown exception.
*/
private void logLookupFailure(String expr, Exception e) {
String msg = LoggerUtils.format("Caught an exception while evaluating expression '#0' against value stack", expr);
if (devMode && LOG.isWarnEnabled()) {
LOG.warn(msg, e);
LOG.warn("Caught an exception while evaluating expression '{}' against value stack", expr, e);
LOG.warn("NOTE: Previous warning message was issued due to devMode set to true.");
} else if (LOG.isDebugEnabled()) {
LOG.debug(msg, e);
} else {
LOG.debug("Caught an exception while evaluating expression '{}' against value stack", expr, e);
}
}
@@ -53,9 +53,7 @@ public class SecurityMemberAccess extends DefaultMemberAccess {
@Override
public boolean isAccessible(Map context, Object target, Member member, String propertyName) {
if (checkEnumAccess(target, member)) {
if (LOG.isTraceEnabled()) {
LOG.trace("Allowing access to enum #0", target);
}
LOG.trace("Allowing access to enum {}", target);
return true;
}
@@ -63,40 +61,30 @@ public class SecurityMemberAccess extends DefaultMemberAccess {
Class memberClass = member.getDeclaringClass();
if (Modifier.isStatic(member.getModifiers()) && allowStaticMethodAccess) {
if (LOG.isDebugEnabled()) {
LOG.debug("Support for accessing static methods [target: #0, member: #1, property: #2] is deprecated!", target, member, propertyName);
}
LOG.debug("Support for accessing static methods [target: {}, member: {}, property: {}] is deprecated!", target, member, propertyName);
if (!isClassExcluded(member.getDeclaringClass())) {
targetClass = member.getDeclaringClass();
}
}
if (isPackageExcluded(targetClass.getPackage(), memberClass.getPackage())) {
if (LOG.isWarnEnabled()) {
LOG.warn("Package of target [#0] or package of member [#1] are excluded!", target, member);
}
LOG.warn("Package of target [{}] or package of member [{}] are excluded!", target, member);
return false;
}
if (isClassExcluded(targetClass)) {
if (LOG.isWarnEnabled()) {
LOG.warn("Target class [#0] is excluded!", target);
}
LOG.warn("Target class [{}] is excluded!", target);
return false;
}
if (isClassExcluded(memberClass)) {
if (LOG.isWarnEnabled()) {
LOG.warn("Declaring class of member type [#0] is excluded!", member);
}
LOG.warn("Declaring class of member type [{}] is excluded!", member);
return false;
}
boolean allow = true;
if (!checkStaticMethodAccess(member)) {
if (LOG.isTraceEnabled()) {
LOG.warn("Access to static [#0] is blocked!", member);
}
LOG.warn("Access to static [{}] is blocked!", member);
allow = false;
}
@@ -128,7 +116,7 @@ public class SecurityMemberAccess extends DefaultMemberAccess {
}
protected boolean isPackageExcluded(Package targetPackage, Package memberPackage) {
if (LOG.isWarnEnabled() && (targetPackage == null || memberPackage == null)) {
if (targetPackage == null || memberPackage == null) {
LOG.warn("The use of the default (unnamed) package is discouraged!");
}
@@ -210,13 +210,9 @@ public class CompoundRootAccessor implements PropertyAccessor, MethodAccessor, C
return sb.toString();
} catch (IntrospectionException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception in callMethod", e);
}
LOG.debug("Got exception in callMethod", e);
} catch (OgnlException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception in callMethod", e);
}
LOG.debug("Got exception in callMethod", e);
}
return null;
@@ -281,9 +277,7 @@ public class CompoundRootAccessor implements PropertyAccessor, MethodAccessor, C
}
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception when tried to get class for name [#0]", e, className);
}
LOG.debug("Got exception when tried to get class for name [{}]", className, e);
}
return Thread.currentThread().getContextClassLoader().loadClass(className);
@@ -120,8 +120,7 @@ public class XWorkMethodAccessor extends ObjectMethodAccessor {
if (LOG.isDebugEnabled()) {
if (!(e.getReason() instanceof NoSuchMethodException)) {
// the method exists on the target object, but something went wrong
String s = "Error calling method through OGNL: object: [#0] method: [#1] args: [#2]";
LOG.debug(s, e.getReason(), object.toString(), methodName, Arrays.toString(objects));
LOG.debug( "Error calling method through OGNL: object: [{}] method: [{}] args: [{}]", e.getReason(), object.toString(), methodName, Arrays.toString(objects));
}
}
throw e;
@@ -149,8 +148,7 @@ public class XWorkMethodAccessor extends ObjectMethodAccessor {
if (LOG.isDebugEnabled()) {
if (!(e.getReason() instanceof NoSuchMethodException)) {
// the method exists on the target class, but something went wrong
String s = "Error calling method through OGNL, class: [#0] method: [#1] args: [#2]";
LOG.debug(s, e.getReason(), aClass.getName(), methodName, Arrays.toString(objects));
LOG.debug("Error calling method through OGNL, class: [{}] method: [{}] args: [{}]", e.getReason(), aClass.getName(), methodName, Arrays.toString(objects));
}
}
throw e;
@@ -27,10 +27,8 @@ public class DefaultAcceptedPatternsChecker implements AcceptedPatternsChecker {
@Inject(value = XWorkConstants.OVERRIDE_ACCEPTED_PATTERNS, required = false)
public void setOverrideAcceptedPatterns(String acceptablePatterns) {
if (LOG.isWarnEnabled()) {
LOG.warn("Overriding accepted patterns [#0] with [#1], be aware that this affects all instances and safety of your application!",
LOG.warn("Overriding accepted patterns [{}] with [{}], be aware that this affects all instances and safety of your application!",
XWorkConstants.OVERRIDE_ACCEPTED_PATTERNS, acceptablePatterns);
}
acceptedPatterns = new HashSet<Pattern>();
for (String pattern : TextParseUtil.commaDelimitedStringToSet(acceptablePatterns)) {
acceptedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
@@ -39,9 +37,7 @@ public class DefaultAcceptedPatternsChecker implements AcceptedPatternsChecker {
@Inject(value = XWorkConstants.ADDITIONAL_ACCEPTED_PATTERNS, required = false)
public void setAdditionalAcceptedPatterns(String acceptablePatterns) {
if (LOG.isDebugEnabled()) {
LOG.warn("Adding additional global patterns [#0] to accepted patterns!", acceptablePatterns);
}
LOG.warn("Adding additional global patterns [{}] to accepted patterns!", acceptablePatterns);
for (String pattern : TextParseUtil.commaDelimitedStringToSet(acceptablePatterns)) {
acceptedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
}
@@ -56,9 +52,7 @@ public class DefaultAcceptedPatternsChecker implements AcceptedPatternsChecker {
}
public void setAcceptedPatterns(Set<String> patterns) {
if (LOG.isTraceEnabled()) {
LOG.trace("Sets accepted patterns [#0]", patterns);
}
LOG.trace("Sets accepted patterns [{}]", patterns);
acceptedPatterns = new HashSet<Pattern>(patterns.size());
for (String pattern : patterns) {
acceptedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
@@ -68,9 +62,7 @@ public class DefaultAcceptedPatternsChecker implements AcceptedPatternsChecker {
public IsAccepted isAccepted(String value) {
for (Pattern acceptedPattern : acceptedPatterns) {
if (acceptedPattern.matcher(value).matches()) {
if (LOG.isTraceEnabled()) {
LOG.trace("[#0] matches accepted pattern [#1]", value, acceptedPattern);
}
LOG.trace("[{}] matches accepted pattern [{}]", value, acceptedPattern);
return IsAccepted.yes(acceptedPattern.toString());
}
}
@@ -28,10 +28,8 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
@Inject(value = XWorkConstants.OVERRIDE_EXCLUDED_PATTERNS, required = false)
public void setOverrideExcludePatterns(String excludePatterns) {
if (LOG.isWarnEnabled()) {
LOG.warn("Overriding excluded patterns [#0] with [#1], be aware that this affects all instances and safety of your application!",
LOG.warn("Overriding excluded patterns [{}] with [{}], be aware that this affects all instances and safety of your application!",
XWorkConstants.OVERRIDE_EXCLUDED_PATTERNS, excludePatterns);
}
excludedPatterns = new HashSet<Pattern>();
for (String pattern : TextParseUtil.commaDelimitedStringToSet(excludePatterns)) {
excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
@@ -40,9 +38,7 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
@Inject(value = XWorkConstants.ADDITIONAL_EXCLUDED_PATTERNS, required = false)
public void setAdditionalExcludePatterns(String excludePatterns) {
if (LOG.isDebugEnabled()) {
LOG.debug("Adding additional global patterns [#0] to excluded patterns!", excludePatterns);
}
LOG.debug("Adding additional global patterns [{}] to excluded patterns!", excludePatterns);
for (String pattern : TextParseUtil.commaDelimitedStringToSet(excludePatterns)) {
excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
}
@@ -57,9 +53,7 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
}
public void setExcludedPatterns(Set<String> patterns) {
if (LOG.isTraceEnabled()) {
LOG.trace("Sets excluded patterns [#0]", patterns);
}
LOG.trace("Sets excluded patterns [{}]", patterns);
excludedPatterns = new HashSet<Pattern>(patterns.size());
for (String pattern : patterns) {
excludedPatterns.add(Pattern.compile(pattern, Pattern.CASE_INSENSITIVE));
@@ -69,9 +63,7 @@ public class DefaultExcludedPatternsChecker implements ExcludedPatternsChecker {
public IsExcluded isExcluded(String value) {
for (Pattern excludedPattern : excludedPatterns) {
if (excludedPattern.matcher(value).matches()) {
if (LOG.isTraceEnabled()) {
LOG.trace("[#0] matches excluded pattern [#1]", value, excludedPattern);
}
LOG.trace("[{}] matches excluded pattern [{}]", value, excludedPattern);
return IsExcluded.yes(excludedPattern);
}
}
@@ -80,16 +80,8 @@ public class DomHelper {
try {
Class clazz = ObjectFactory.getObjectFactory().getClassInstance(parserProp);
factory = (SAXParserFactory) clazz.newInstance();
}
catch (ClassNotFoundException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to load saxParserFactory set by system property 'xwork.saxParserFactory': #0", e, parserProp);
}
}
catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to load saxParserFactory set by system property 'xwork.saxParserFactory': #0", e, parserProp);
}
} catch (Exception e) {
LOG.error("Unable to load saxParserFactory set by system property 'xwork.saxParserFactory': {}", parserProp, e);
}
}
@@ -150,16 +142,8 @@ public class DomHelper {
try {
Class clazz = ObjectFactory.getObjectFactory().getClassInstance(parserProp);
FACTORY = (SAXTransformerFactory) clazz.newInstance();
}
catch (ClassNotFoundException e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to load SAXTransformerFactory set by system property 'xwork.saxTransformerFactory': #0", e, parserProp);
}
}
catch (Exception e) {
if (LOG.isErrorEnabled()) {
LOG.error("Unable to load SAXTransformerFactory set by system property 'xwork.saxTransformerFactory': #0", e, parserProp);
}
} catch (Exception e) {
LOG.error("Unable to load SAXTransformerFactory set by system property 'xwork.saxTransformerFactory': {}", parserProp, e);
}
}
@@ -348,8 +332,8 @@ public class DomHelper {
if (dtdMappings != null && dtdMappings.containsKey(publicId)) {
String dtdFile = dtdMappings.get(publicId);
return new InputSource(ClassLoaderUtil.getResourceAsStream(dtdFile, DomHelper.class));
} else if (LOG.isWarnEnabled()) {
LOG.warn("Local DTD is missing for publicID: #0 - defined mappings: #1", publicId, dtdMappings);
} else {
LOG.warn("Local DTD is missing for publicID: {} - defined mappings: {}", publicId, dtdMappings);
}
return null;
}
@@ -367,8 +351,7 @@ public class DomHelper {
@Override
public void fatalError(SAXParseException exception) throws SAXException {
LOG.fatal(exception.getMessage() + " at (" + exception.getPublicId() + ":" +
exception.getLineNumber() + ":" + exception.getColumnNumber() + ")", exception);
LOG.fatal("{} at ({}:{}:{})", exception.getMessage(), exception.getPublicId(), exception.getLineNumber(), exception.getColumnNumber(), exception);
throw exception;
}
}
@@ -223,9 +223,9 @@ public class LocalizedTextUtil {
}
if (devMode) {
LOG.warn("Missing key [#0] in bundles [#1]!", aTextName, localList);
} else if (LOG.isDebugEnabled()) {
LOG.debug("Missing key [#0] in bundles [#1]!", aTextName, localList);
LOG.warn("Missing key [{}] in bundles [{}]!", aTextName, localList);
} else {
LOG.debug("Missing key [{}] in bundles [{}]!", aTextName, localList);
}
return null;
@@ -281,9 +281,7 @@ public class LocalizedTextUtil {
bundle = bundlesMap.get(key);
}
} catch (MissingResourceException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Missing resource bundle [#0]!", aBundleName);
}
LOG.debug("Missing resource bundle [{}]!", aBundleName, e);
}
}
}
@@ -643,15 +641,15 @@ public class LocalizedTextUtil {
return formatWithNullDetection(mf, args);
} catch (MissingResourceException ex) {
if (devMode) {
LOG.warn("Missing key [#0] in bundle [#1]!", aTextName, bundle);
} else if (LOG.isDebugEnabled()) {
LOG.debug("Missing key [#0] in bundle [#1]!", aTextName, bundle);
LOG.warn("Missing key [{}] in bundle [{}]!", aTextName, bundle);
} else {
LOG.debug("Missing key [{}] in bundle [{}]!", aTextName, bundle);
}
}
GetDefaultMessageReturnArg result = getDefaultMessage(aTextName, locale, valueStack, args, defaultMessage);
if (LOG.isWarnEnabled() && unableToFindTextForKey(result)) {
LOG.warn("Unable to find text for key '" + aTextName + "' in ResourceBundles for locale '" + locale + "'");
if (unableToFindTextForKey(result)) {
LOG.warn("Unable to find text for key '{}' in ResourceBundles for locale '{}'", aTextName, locale);
}
return result != null ? result.message : null;
}
@@ -699,9 +697,9 @@ public class LocalizedTextUtil {
return formatWithNullDetection(mf, args);
} catch (MissingResourceException e) {
if (devMode) {
LOG.warn("Missing key [#0] in bundle [#1]!", key, bundleName);
} else if (LOG.isDebugEnabled()) {
LOG.debug("Missing key [#0] in bundle [#1]!", key, bundleName);
LOG.warn("Missing key [{}] in bundle [{}]!", key, bundleName);
} else {
LOG.debug("Missing key [{}] in bundle [{}]!", key, bundleName);
}
return null;
}
@@ -821,11 +819,10 @@ public class LocalizedTextUtil {
// now, for the true and utter hack, if we're running in tomcat, clear
// it's class loader resource cache as well.
clearTomcatCache();
if(context!=null)
if(context!=null) {
context.put(RELOADED, true);
if (LOG.isDebugEnabled()) {
LOG.debug("Resource bundles reloaded");
}
LOG.debug("Resource bundles reloaded");
}
} catch (Exception e) {
LOG.error("Could not reload resource bundles", e);
@@ -843,27 +840,19 @@ public class LocalizedTextUtil {
if ("org.apache.catalina.loader.WebappClassLoader".equals(cl.getName())) {
clearMap(cl, loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
} else {
if (LOG.isDebugEnabled()) {
LOG.debug("class loader " + cl.getName() + " is not tomcat loader.");
}
LOG.debug("Class loader {} is not tomcat loader.", cl.getName());
}
} catch (NoSuchFieldException nsfe) {
if ("org.apache.catalina.loader.WebappClassLoaderBase".equals(cl.getSuperclass().getName())) {
if (LOG.isDebugEnabled()) {
LOG.debug("Base class #0 doesn't contain '#1' field, trying with parent!", nsfe, cl.getName(), TOMCAT_RESOURCE_ENTRIES_FIELD);
}
LOG.debug("Base class {} doesn't contain '{}' field, trying with parent!", cl.getName(), TOMCAT_RESOURCE_ENTRIES_FIELD, nsfe);
try {
clearMap(cl.getSuperclass(), loader, TOMCAT_RESOURCE_ENTRIES_FIELD);
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Couldn't clear tomcat cache using #0", e, cl.getSuperclass().getName());
}
LOG.warn("Couldn't clear tomcat cache using {}", cl.getSuperclass().getName(), e);
}
}
} catch (Exception e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Couldn't clear tomcat cache", e, cl.getName());
}
LOG.warn("Couldn't clear tomcat cache", cl.getName(), e);
}
}
@@ -35,9 +35,7 @@ public class URLUtil {
*/
@Deprecated
public static boolean verifyUrl(String url) {
if (LOG.isDebugEnabled()) {
LOG.debug("Checking if url [#0] is valid", url);
}
LOG.debug("Checking if url [{}] is valid", url);
if (url == null) {
return false;
}
@@ -52,9 +50,7 @@ public class URLUtil {
return true;
} catch (MalformedURLException e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Url [#0] is invalid: #1", e, url, e.getMessage());
}
LOG.debug("Url [{}] is invalid: {}", url, e.getMessage(), e);
return false;
}
}
@@ -46,8 +46,7 @@ public final class FileResourceStore implements ResourceStore {
return data;
} catch (Exception e) {
if (LOG.isDebugEnabled())
LOG.debug("Unable to read file [#0]", e, pResourceName);
LOG.debug("Unable to read file [{}]", pResourceName, e);
return null;
} finally {
closeQuietly(fis);
@@ -63,8 +62,7 @@ public final class FileResourceStore implements ResourceStore {
if (is != null)
is.close();
} catch (IOException e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to close file input stream", e);
LOG.error("Unable to close file input stream", e);
}
}
@@ -51,8 +51,7 @@ public class JarResourceStore implements ResourceStore {
return out.toByteArray();
} catch (Exception e) {
if (LOG.isDebugEnabled())
LOG.debug("Unable to read file [#0] from [#1]", e, pResourceName, file.getName());
LOG.debug("Unable to read file [{}] from [{}]", pResourceName, file.getName(), e);
return null;
} finally {
closeQuietly(in);
@@ -76,8 +75,7 @@ public class JarResourceStore implements ResourceStore {
if (is != null)
is.close();
} catch (IOException e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to close input stream", e);
LOG.error("Unable to close input stream", e);
}
}
}
@@ -66,10 +66,12 @@ public class ReloadingClassLoader extends ClassLoader {
} catch (RuntimeException e) {
// see WW-3121
// TODO: Fix this for a reloading mechanism to be marked as stable
if (root != null)
LOG.error("Exception while trying to build the ResourceStore for URL [#0]", e, root.toString());
else
if (root != null) {
LOG.error("Exception while trying to build the ResourceStore for URL [{}]", root.toString(), e);
}
else {
LOG.error("Exception while trying to get root resource from class loader", e);
}
LOG.error("Consider setting struts.convention.classes.reload=false");
throw e;
}
@@ -85,8 +85,7 @@ public class DefaultClassFinder implements ClassFinder {
}
}
} catch (Exception e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to read URL [#0]", e, location.toExternalForm());
LOG.error("Unable to read URL [{}]", location.toExternalForm(), e);
}
}
@@ -95,8 +94,7 @@ public class DefaultClassFinder implements ClassFinder {
if (classNameFilter.test(className))
readClassDef(className);
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Unable to read class [#0]", e, className);
LOG.error("Unable to read class [{}]", className, e);
}
}
}
@@ -189,8 +187,7 @@ public class DefaultClassFinder implements ClassFinder {
classes.add(clazz);
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -220,8 +217,7 @@ public class DefaultClassFinder implements ClassFinder {
}
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -251,8 +247,7 @@ public class DefaultClassFinder implements ClassFinder {
}
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -282,8 +277,7 @@ public class DefaultClassFinder implements ClassFinder {
}
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -302,8 +296,7 @@ public class DefaultClassFinder implements ClassFinder {
classes.add(classInfo.get());
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -319,8 +312,7 @@ public class DefaultClassFinder implements ClassFinder {
classes.add(classInfo.get());
}
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -334,8 +326,7 @@ public class DefaultClassFinder implements ClassFinder {
try {
classes.add(classInfo.get());
} catch (Throwable e) {
if (LOG.isErrorEnabled())
LOG.error("Error loading class [#0]", e, classInfo.getName());
LOG.error("Error loading class [{}]", classInfo.getName(), e);
classesNotLoaded.add(classInfo.getName());
}
}
@@ -352,8 +343,7 @@ public class DefaultClassFinder implements ClassFinder {
urls.add(url);
}
} catch (IOException ioe) {
if (LOG.isErrorEnabled())
LOG.error("Could not read driectory [#0]", ioe, dirName);
LOG.error("Could not read directory [{}]", dirName, ioe);
}
}
@@ -397,9 +387,9 @@ public class DefaultClassFinder implements ClassFinder {
} finally {
in.close();
}
} else if (LOG.isDebugEnabled())
LOG.debug("Unable to read [#0]", location.toExternalForm());
} else {
LOG.debug("Unable to read [{}]", location.toExternalForm());
}
return Collections.emptyList();
}
@@ -836,9 +836,7 @@ public class ResourceFinder {
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception loading resources for #0", e, uri);
}
LOG.debug("Got exception loading resources for {}", uri, e);
}
}
@@ -871,9 +869,7 @@ public class ResourceFinder {
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception search for subpackages for #0", e, uri);
}
LOG.debug("Got exception search for subpackages for {}", uri, e);
}
}
@@ -906,9 +902,7 @@ public class ResourceFinder {
result.put(location, convertPathsToPackages(resources));
}
} catch (Exception e) {
if (LOG.isDebugEnabled()) {
LOG.debug("Got exception finding subpackages for #0", e, uri);
}
LOG.debug("Got exception finding subpackages for {}", uri, e);
}
}
@@ -237,9 +237,9 @@ public class UrlSet {
//build a URL pointing to the jar, instead of the META-INF dir
url = new URL(StringUtils.substringBefore(externalForm, "META-INF"));
list.add(url);
} else if (LOG.isDebugEnabled())
LOG.debug("Ignoring URL [#0] because it is not a jar", url.toExternalForm());
} else {
LOG.debug("Ignoring URL [{}] because it is not a jar", url.toExternalForm());
}
}
//usually the "classes" dir
@@ -264,17 +264,14 @@ public class UrlSet {
//build a URL pointing to the jar, instead of the META-INF dir
url = new URL(StringUtils.substringBefore(externalForm, "META-INF"));
list.add(url);
} else if (LOG.isDebugEnabled())
LOG.debug("Ignoring URL [#0] because it is not a valid protocol", url.toExternalForm());
} else {
LOG.debug("Ignoring URL [{}] because it is not a valid protocol", url.toExternalForm());
}
}
return list;
}
public static interface FileProtocolNormalizer {
URL normalizeToFileProtocol(URL url);
}
}
@@ -126,15 +126,11 @@ public class DefaultFileManager implements FileManager {
} else if ("file".equals(url.getProtocol())) {
return url; // it's already a file
} else {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not normalize URL [#0] to file protocol!", url.toString());
}
LOG.warn("Could not normalize URL [{}] to file protocol!", url);
return null;
}
} catch (MalformedURLException e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Error normalizing URL [#0] to file protocol!", e, url.toString());
}
LOG.warn("Error normalizing URL [{}] to file protocol!", url, e);
return null;
}
}
@@ -40,24 +40,18 @@ public class DefaultFileManagerFactory implements FileManagerFactory {
public FileManager getFileManager() {
FileManager fileManager = lookupFileManager();
if (fileManager != null) {
if (LOG.isDebugEnabled()) {
LOG.debug("Using FileManager implementation [#0]", fileManager.getClass().getSimpleName());
}
LOG.debug("Using FileManager implementation [{}]", fileManager.getClass().getSimpleName());
fileManager.setReloadingConfigs(reloadingConfigs);
return fileManager;
}
if (LOG.isDebugEnabled()) {
LOG.debug("Using default implementation of FileManager provided under name [system]: #0", systemFileManager.getClass().getSimpleName());
}
LOG.debug("Using default implementation of FileManager provided under name [system]: {}", systemFileManager.getClass().getSimpleName());
systemFileManager.setReloadingConfigs(reloadingConfigs);
return systemFileManager;
}
private FileManager lookupFileManager() {
Set<String> names = container.getInstanceNames(FileManager.class);
if (LOG.isDebugEnabled()) {
LOG.debug("Found following implementations of FileManager interface: #0", names.toString());
}
LOG.debug("Found following implementations of FileManager interface: {}", names);
Set<FileManager> internals = new HashSet<FileManager>();
Set<FileManager> users = new HashSet<FileManager>();
for (String fmName : names) {
@@ -70,15 +64,11 @@ public class DefaultFileManagerFactory implements FileManagerFactory {
}
for (FileManager fm : users) {
if (fm.support()) {
if (LOG.isDebugEnabled()) {
LOG.debug("Using FileManager implementation [#0]", fm.getClass().getSimpleName());
}
LOG.debug("Using FileManager implementation [{}]", fm.getClass().getSimpleName());
return fm;
}
}
if (LOG.isDebugEnabled()) {
LOG.debug("No user defined FileManager, looking up for internal implementations!");
}
LOG.debug("No user defined FileManager, looking up for internal implementations!");
for (FileManager fm : internals) {
if (fm.support()) {
return fm;
@@ -35,11 +35,10 @@ public class JarEntryRevision extends Revision {
separatorIndex = fileName.lastIndexOf(JAR_FILE_EXTENSION_END);
}
if (separatorIndex == -1) {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not find end of jar file!");
}
LOG.warn("Could not find end of jar file!");
return null;
}
// Split file name
jarFileName = fileName.substring(0, separatorIndex);
int index = separatorIndex + JAR_FILE_NAME_SEPARATOR.length();
@@ -54,9 +53,7 @@ public class JarEntryRevision extends Revision {
return null;
}
} catch (Throwable e) {
if (LOG.isWarnEnabled()) {
LOG.warn("Could not create JarEntryRevision for [#0]!", e, jarFileName);
}
LOG.warn("Could not create JarEntryRevision for [{}]!", jarFileName, e);
return null;
}
}
@@ -174,7 +174,7 @@ public class DefaultValidatorFactory implements ValidatorFactory {
}
}
} catch (Exception ex) {
LOG.error("Unable to load #0", ex, u.toString());
LOG.error("Unable to load {}", u, ex);
}
}
} catch (IOException e) {
@@ -70,13 +70,11 @@ public class ExpressionValidator extends ValidatorSupport {
if ((obj != null) && (obj instanceof Boolean)) {
answer = (Boolean) obj;
} else {
log.warn("Got result of [#0] when trying to get Boolean.", obj);
log.warn("Got result of [{}] when trying to get Boolean.", obj);
}
if (!answer) {
if (log.isDebugEnabled()) {
log.debug("Validation failed on expression [#0] with validated object [#1]", expression, object);
}
log.debug("Validation failed on expression [{}] with validated object [{}]", expression, object);
addActionError(object);
}
}
@@ -76,9 +76,7 @@ public abstract class RangeValidatorSupport<T extends Comparable> extends FieldV
}
public void setMinExpression(String minExpression) {
if (LOG.isDebugEnabled()) {
LOG.debug("${minExpression} was defined as [#0]", minExpression);
}
LOG.debug("${minExpression} was defined as [{}]", minExpression);
this.minExpression = minExpression;
}
@@ -97,9 +95,7 @@ public abstract class RangeValidatorSupport<T extends Comparable> extends FieldV
}
public void setMaxExpression(String maxExpression) {
if (LOG.isDebugEnabled()) {
LOG.debug("${maxExpression} was defined as [#0]", maxExpression);
}
LOG.debug("${maxExpression} was defined as [{}]", maxExpression);
this.maxExpression = maxExpression;
}
@@ -95,9 +95,8 @@ public class RegexFieldValidator extends FieldValidatorSupport {
// if there is no value - don't do comparison
// if a value is required, a required validator should be added to the field
String regexToUse = getRegex();
if (LOG.isDebugEnabled()) {
LOG.debug("Defined regexp as [#0]", regexToUse);
}
LOG.debug("Defined regexp as [{}]", regexToUse);
if (value == null || regexToUse == null) {
return;
}