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 Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/8e877115 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8e877115 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8e877115 Branch: refs/heads/master Commit: 8e8771153af36b3ce111b5b2289bdab2c8bbd937 Parents: 95805e5 Author: Johannes Geppert <joh...@gmail.com> Authored: Mon May 25 21:25:50 2015 +0200 Committer: Johannes Geppert <joh...@gmail.com> Committed: Mon May 25 21:25:50 2015 +0200 ---------------------------------------------------------------------- .../java/org/apache/struts2/RequestUtils.java | 6 +- .../org/apache/struts2/components/Date.java | 6 +- .../org/apache/struts2/components/UIBean.java | 4 +- .../components/template/BaseTemplateEngine.java | 2 +- .../config/AbstractBeanSelectionProvider.java | 10 ++- .../config/DefaultBeanSelectionProvider.java | 6 +- .../DefaultDispatcherErrorHandler.java | 6 +- .../dispatcher/DefaultStaticContentLoader.java | 2 +- .../apache/struts2/dispatcher/Dispatcher.java | 14 ++-- .../struts2/dispatcher/HttpHeaderResult.java | 2 +- .../dispatcher/ServletRedirectResult.java | 16 ++--- .../struts2/dispatcher/VelocityResult.java | 4 +- .../dispatcher/mapper/DefaultActionMapper.java | 10 +-- .../mapper/PrefixBasedActionMapper.java | 28 ++++---- .../multipart/JakartaMultiPartRequest.java | 19 ++---- .../JakartaStreamMultiPartRequest.java | 20 +++--- .../multipart/MultiPartRequestWrapper.java | 2 +- .../impl/PrefixBasedActionProxyFactory.java | 16 ++--- .../interceptor/CheckboxInterceptor.java | 4 +- .../struts2/interceptor/CookieInterceptor.java | 20 +++--- .../interceptor/CookieProviderInterceptor.java | 10 +-- .../struts2/interceptor/I18nInterceptor.java | 6 +- .../struts2/interceptor/RolesInterceptor.java | 2 +- .../org/apache/struts2/util/StrutsUtil.java | 6 +- .../struts2/util/SubsetIteratorFilter.java | 6 +- .../struts2/util/fs/JBossFileManager.java | 28 +++----- .../views/freemarker/FreemarkerManager.java | 4 +- .../struts2/views/freemarker/tags/TagModel.java | 4 +- .../struts2/views/util/DefaultUrlHelper.java | 8 +-- .../apache/struts2/views/xslt/BeanAdapter.java | 9 +-- .../apache/struts2/views/xslt/XSLTResult.java | 4 +- .../convention/ConventionUnknownHandler.java | 38 ++++------- .../DefaultInterceptorMapBuilder.java | 2 +- .../convention/DefaultResultMapBuilder.java | 31 ++++----- .../PackageBasedActionConfigBuilder.java | 70 ++++++++------------ .../convention/SEOActionNameBuilder.java | 4 +- .../main/java/org/apache/struts2/JSPLoader.java | 14 ++-- .../jasperreports/ValueStackDataSource.java | 15 ++--- .../struts2/convention/Java8ClassFinder.java | 36 ++++------ .../views/java/DefaultTagHandlerFactory.java | 3 +- .../apache/struts2/views/java/DefaultTheme.java | 4 +- .../struts2/views/java/JavaTemplateEngine.java | 24 ++----- .../org/apache/struts2/json/JSONWriter.java | 4 +- .../struts2/osgi/DefaultBundleAccessor.java | 3 +- .../struts2/osgi/OsgiConfigurationProvider.java | 16 ++--- .../java/org/apache/struts2/osgi/OsgiUtil.java | 6 +- .../apache/struts2/osgi/StrutsOsgiListener.java | 5 +- .../apache/struts2/osgi/host/BaseOsgiHost.java | 44 +++++------- .../apache/struts2/osgi/host/FelixOsgiHost.java | 21 ++---- .../struts2/osgi/host/GlassfishOSGiHost.java | 9 +-- .../DefaultOValValidationManager.java | 6 +- .../interceptor/OValValidationInterceptor.java | 22 ++---- .../multipart/PellMultiPartRequest.java | 4 +- .../ClassReloadingXMLWebApplicationContext.java | 14 ++-- .../xwork2/DefaultActionInvocation.java | 12 +--- .../opensymphony/xwork2/DefaultActionProxy.java | 4 +- .../xwork2/config/ConfigurationManager.java | 22 ++---- .../config/providers/InterceptorBuilder.java | 14 ++-- .../providers/XmlConfigurationProvider.java | 57 ++++------------ .../DefaultConversionAnnotationProcessor.java | 12 ++-- .../impl/DefaultConversionFileProcessor.java | 26 ++------ .../DefaultConversionPropertiesProcessor.java | 10 +-- .../impl/DefaultObjectTypeDeterminer.java | 4 +- .../xwork2/conversion/impl/XWorkConverter.java | 42 +++++------- .../xwork2/factory/DefaultConverterFactory.java | 4 +- .../interceptor/DefaultWorkflowInterceptor.java | 16 ++--- .../xwork2/interceptor/I18nInterceptor.java | 22 +++--- .../interceptor/ParametersInterceptor.java | 8 +-- .../interceptor/PrefixMethodInvocationUtil.java | 4 +- .../xwork2/ognl/OgnlValueStack.java | 13 ++-- .../xwork2/ognl/SecurityMemberAccess.java | 26 ++------ .../ognl/accessor/CompoundRootAccessor.java | 12 +--- .../ognl/accessor/XWorkMethodAccessor.java | 6 +- .../DefaultAcceptedPatternsChecker.java | 16 ++--- .../DefaultExcludedPatternsChecker.java | 16 ++--- .../com/opensymphony/xwork2/util/DomHelper.java | 31 ++------- .../xwork2/util/LocalizedTextUtil.java | 47 +++++-------- .../com/opensymphony/xwork2/util/URLUtil.java | 8 +-- .../util/classloader/FileResourceStore.java | 6 +- .../util/classloader/JarResourceStore.java | 6 +- .../util/classloader/ReloadingClassLoader.java | 8 ++- .../xwork2/util/finder/DefaultClassFinder.java | 36 ++++------ .../xwork2/util/finder/ResourceFinder.java | 12 +--- .../opensymphony/xwork2/util/finder/UrlSet.java | 15 ++--- .../xwork2/util/fs/DefaultFileManager.java | 8 +-- .../util/fs/DefaultFileManagerFactory.java | 20 ++---- .../xwork2/util/fs/JarEntryRevision.java | 9 +-- .../validator/DefaultValidatorFactory.java | 2 +- .../validators/ExpressionValidator.java | 6 +- .../validators/RangeValidatorSupport.java | 8 +-- .../validators/RegexFieldValidator.java | 5 +- 91 files changed, 416 insertions(+), 836 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/RequestUtils.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/RequestUtils.java b/core/src/main/java/org/apache/struts2/RequestUtils.java index 0ba079d..a09f879 100644 --- a/core/src/main/java/org/apache/struts2/RequestUtils.java +++ b/core/src/main/java/org/apache/struts2/RequestUtils.java @@ -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; } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/components/Date.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/components/Date.java b/core/src/main/java/org/apache/struts2/components/Date.java index e086276..ac61fc7 100644 --- a/core/src/main/java/org/apache/struts2/components/Date.java +++ b/core/src/main/java/org/apache/struts2/components/Date.java @@ -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 http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/components/UIBean.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/components/UIBean.java b/core/src/main/java/org/apache/struts2/components/UIBean.java index 8c9ebf6..4f015e9 100644 --- a/core/src/main/java/org/apache/struts2/components/UIBean.java +++ b/core/src/main/java/org/apache/struts2/components/UIBean.java @@ -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; http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java b/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java index cf7414a..097d09c 100644 --- a/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java +++ b/core/src/main/java/org/apache/struts2/components/template/BaseTemplateEngine.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java index a75b877..0bc7f30 100644 --- a/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java +++ b/core/src/main/java/org/apache/struts2/config/AbstractBeanSelectionProvider.java @@ -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()); } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java index 671ea59..1f66d16 100644 --- a/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java +++ b/core/src/main/java/org/apache/struts2/config/DefaultBeanSelectionProvider.java @@ -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); } } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/DefaultDispatcherErrorHandler.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DefaultDispatcherErrorHandler.java b/core/src/main/java/org/apache/struts2/dispatcher/DefaultDispatcherErrorHandler.java index 2b4061c..78ca2c8 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/DefaultDispatcherErrorHandler.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/DefaultDispatcherErrorHandler.java @@ -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; http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java index d6004eb..4d27f49 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/DefaultStaticContentLoader.java @@ -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(); http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java index d01d6e7..707c051 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java @@ -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); } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java b/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java index 1f07c42..d25772b 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/HttpHeaderResult.java @@ -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) { http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java index 2293c59..9476221 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/ServletRedirectResult.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java b/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java index 2a00ad9..e16bb81 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/VelocityResult.java @@ -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) { http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java index 1370d0e..03c7ac5 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/DefaultActionMapper.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java b/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java index f43d802..b0adc3d 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/mapper/PrefixBasedActionMapper.java @@ -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); } } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java index 5e1d19d..635b420 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaMultiPartRequest.java @@ -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()); http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java index e0c5294..12aad31 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/JakartaStreamMultiPartRequest.java @@ -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); } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java index 6c4b079..f7d7bb0 100644 --- a/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java +++ b/core/src/main/java/org/apache/struts2/dispatcher/multipart/MultiPartRequestWrapper.java @@ -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); } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java b/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java index 56f86e5..5628aa4 100644 --- a/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java +++ b/core/src/main/java/org/apache/struts2/impl/PrefixBasedActionProxyFactory.java @@ -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); } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java index 5042008..b6410b8 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CheckboxInterceptor.java @@ -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; } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java index 74e104b..76a4f2c 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CookieInterceptor.java @@ -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); } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/interceptor/CookieProviderInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/CookieProviderInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/CookieProviderInterceptor.java index f2798a0..60313b9 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/CookieProviderInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/CookieProviderInterceptor.java @@ -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); } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java index d2632c5..2112401 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/I18nInterceptor.java @@ -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 } "); } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java index d7a5150..eb087c1 100644 --- a/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java +++ b/core/src/main/java/org/apache/struts2/interceptor/RolesInterceptor.java @@ -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); } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/util/StrutsUtil.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java index c0fcbde..2641109 100644 --- a/core/src/main/java/org/apache/struts2/util/StrutsUtil.java +++ b/core/src/main/java/org/apache/struts2/util/StrutsUtil.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java b/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java index cacdd1c..cb894d4 100644 --- a/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java +++ b/core/src/main/java/org/apache/struts2/util/SubsetIteratorFilter.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java b/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java index 10881e9..5b876cc 100644 --- a/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java +++ b/core/src/main/java/org/apache/struts2/util/fs/JBossFileManager.java @@ -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) { http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java index 28b7a5f..c221915 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/FreemarkerManager.java @@ -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 http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java index bf1495b..ba7e37d 100644 --- a/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java +++ b/core/src/main/java/org/apache/struts2/views/freemarker/tags/TagModel.java @@ -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 http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java b/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java index 111f70b..ab9c4dc 100644 --- a/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java +++ b/core/src/main/java/org/apache/struts2/views/util/DefaultUrlHelper.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java b/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java index 0b242e3..d552bdb 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/BeanAdapter.java @@ -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; http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java index d0225e8..d3f474b 100644 --- a/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java +++ b/core/src/main/java/org/apache/struts2/views/xslt/XSLTResult.java @@ -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; } } http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java ---------------------------------------------------------------------- diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java index 429d25b..4ba807b 100644 --- a/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java +++ b/plugins/convention/src/main/java/org/apache/struts2/convention/ConventionUnknownHandler.java @@ -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; http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java ---------------------------------------------------------------------- diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java index a678544..0e9edd8 100644 --- a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java +++ b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultInterceptorMapBuilder.java @@ -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()); http://git-wip-us.apache.org/repos/asf/struts/blob/8e877115/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java ---------------------------------------------------------------------- diff --git a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java index 0847bc7..d27381d 100644 --- a/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java +++ b/plugins/convention/src/main/java/org/apache/struts2/convention/DefaultResultMapBuilder.java @@ -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); }