aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2016-06-22 13:29:11 +0000
committerClaude Brisson <cbrisson@apache.org>2016-06-22 13:29:11 +0000
commitf09bc7956e8e0f03067cfc39760c6a2c0f1387a9 (patch)
tree249de92b0aa01b87f5e4cc36dddb1e1d595f70bb /velocity-engine-core/src/main/java/org
parentf58da686672b7e103d8bcee72082d537b77a23d6 (diff)
downloadapache-velocity-engine-f09bc7956e8e0f03067cfc39760c6a2c0f1387a9.tar.gz
fix some parametrized logger messages for slf4j '{}' placeholders, and add parametrization when possible
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1749696 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java/org')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java6
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java14
-rwxr-xr-xvelocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java8
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java29
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java8
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java14
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java9
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java4
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java4
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java10
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java18
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java8
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java2
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java6
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java8
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java5
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java3
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java22
18 files changed, 81 insertions, 97 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
index 2ed7a5b2..c12211f6 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
@@ -427,7 +427,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
if (log.isDebugEnabled())
{
- log.debug("Default Properties File: " +
+ log.debug("Default Properties File: {}",
new File(DEFAULT_RUNTIME_PROPERTIES).getPath());
}
@@ -984,7 +984,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
{
String directiveClass = (String) directiveClasses.nextElement();
loadDirective(directiveClass);
- log.debug("Loaded System Directive: " + directiveClass);
+ log.debug("Loaded System Directive: {}", directiveClass);
}
/*
@@ -998,7 +998,7 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
loadDirective(userdirective[i]);
if (log.isDebugEnabled())
{
- log.debug("Loaded User Directive: " + userdirective[i]);
+ log.debug("Loaded User Directive: {}", userdirective[i]);
}
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
index d02c0b02..27f03015 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
@@ -151,9 +151,7 @@ public class VelocimacroFactory
if (libfiles == null)
{
- log.debug("\"" + RuntimeConstants.VM_LIBRARY +
- "\" is not set. Trying default library: " +
- RuntimeConstants.VM_LIBRARY_DEFAULT);
+ log.debug("\"{}\" is not set. Trying default library: {}", RuntimeConstants.VM_LIBRARY, RuntimeConstants.VM_LIBRARY_DEFAULT);
// try the default library.
if (rsvc.getLoaderNameForResource(RuntimeConstants.VM_LIBRARY_DEFAULT) != null)
@@ -195,7 +193,7 @@ public class VelocimacroFactory
vmManager.setRegisterFromLib(true);
- log.debug("adding VMs from VM library : " + lib);
+ log.debug("adding VMs from VM library : {}", lib);
try
{
@@ -466,7 +464,7 @@ public class VelocimacroFactory
}
if (log.isDebugEnabled())
{
- log.debug("added VM "+name+": source="+sourceTemplate);
+ log.debug("added VM {}: source={}", name, sourceTemplate);
}
return true;
}
@@ -501,7 +499,7 @@ public class VelocimacroFactory
*/
if (!addNewAllowed)
{
- log.warn("VM addition rejected : "+name+" : inline VMs not allowed.");
+ log.warn("VM addition rejected : {} : inline VelociMacros not allowed.", name);
return false;
}
@@ -526,7 +524,7 @@ public class VelocimacroFactory
* some macro
*/
if (log.isDebugEnabled())
- log.debug("VM addition rejected : "+name+" : inline not allowed to replace existing VM");
+ log.debug("VM addition rejected : {} : inline not allowed to replace existing VM", name);
return false;
}
}
@@ -617,7 +615,7 @@ public class VelocimacroFactory
if (ft > tt)
{
- log.debug("auto-reloading VMs from VM library : " + lib);
+ log.debug("auto-reloading VMs from VM library : {}", lib);
/*
* when there are VMs in a library that invoke each other, there are
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
index 12699b0e..71ac3dd1 100755
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
@@ -84,9 +84,8 @@ public abstract class Block extends Directive
}
catch (IOException e)
{
- String msg = "Failed to render " + id(context) + " to writer "
- + " at " + StringUtils.formatFileString(this);
-
+ String msg = "Failed to render " + id(context) + " to writer at " +
+ StringUtils.formatFileString(this);
log.error(msg, e);
throw new RuntimeException(msg, e);
}
@@ -152,8 +151,7 @@ public abstract class Block extends Directive
* use recursive block definitions and having problems
* pulling it off properly.
*/
- parent.log.debug("Max recursion depth reached for " + parent.id(context)
- + " at " + StringUtils.formatFileString(parent));
+ parent.log.debug("Max recursion depth reached for {} at {}", parent.id(context), StringUtils.formatFileString(parent));
depth--;
return false;
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
index c5f5b956..b5c2985e 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
@@ -428,8 +428,9 @@ public class ASTReference extends SimpleNode
{
if (referenceType != QUIET_REFERENCE)
{
- log.error("Prepend the reference with '$!' e.g., $!" + literal().substring(1)
- + " if you want Velocity to ignore the reference when it evaluates to null");
+ log.error("Prepend the reference with '$!' e.g., $!{}" +
+ " if you want Velocity to ignore the reference when it evaluates to null",
+ literal().substring(1));
if (value == null)
{
throw new VelocityException("Reference " + literal()
@@ -467,9 +468,8 @@ public class ASTReference extends SimpleNode
if (logOnNull && referenceType != QUIET_REFERENCE && log.isDebugEnabled())
{
- log.debug("Null reference [template '" + getTemplateName()
- + "', line " + this.getLine() + ", column " + this.getColumn() + "] : "
- + this.literal() + " cannot be resolved.");
+ log.debug("Null reference [template '{}', line {}, column {}] : {} cannot be resolved.",
+ getTemplateName(), this.getLine(), this.getColumn(), this.literal());
}
return true;
}
@@ -591,9 +591,8 @@ public class ASTReference extends SimpleNode
if (result == null)
{
- String msg = "reference set is not a valid reference at "
- + StringUtils.formatFileString(uberInfo);
- log.error(msg);
+ log.error("reference set is not a valid reference at {}",
+ StringUtils.formatFileString(uberInfo));
return false;
}
@@ -615,10 +614,8 @@ public class ASTReference extends SimpleNode
jjtGetChild(i+1).getLine(), jjtGetChild(i+1).getColumn());
}
- String msg = "reference set is not a valid reference at "
- + StringUtils.formatFileString(uberInfo);
- log.error(msg);
-
+ log.error("reference set is not a valid reference at {}",
+ StringUtils.formatFileString(uberInfo));
return false;
}
}
@@ -976,8 +973,8 @@ public class ASTReference extends SimpleNode
}
catch(RuntimeException e)
{
- log.error("Exception calling reference $" + variable + " at "
- + StringUtils.formatFileString(uberInfo));
+ log.error("Exception calling reference ${} at {}",
+ variable, StringUtils.formatFileString(uberInfo));
throw e;
}
@@ -985,8 +982,8 @@ public class ASTReference extends SimpleNode
{
if (!context.containsKey(variable))
{
- log.error("Variable $" + variable + " has not been set at "
- + StringUtils.formatFileString(uberInfo));
+ log.error("Variable ${} has not been set at {}",
+ variable, StringUtils.formatFileString(uberInfo));
throw new MethodInvocationException("Variable $" + variable +
" has not been set", null, identifier,
uberInfo.getTemplateName(), uberInfo.getLine(), uberInfo.getColumn());
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
index 7cc636af..26ff9c24 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
@@ -107,7 +107,7 @@ public class ResourceManagerImpl
this.rsvc = rsvc;
log = rsvc.getLog();
- log.trace("ResourceManager initializing: %s", this.getClass());
+ log.trace("ResourceManager initializing: {}", this.getClass());
assembleResourceLoaderInitializers();
@@ -240,7 +240,7 @@ public class ResourceManagerImpl
if (loaderConfiguration == null)
{
log.debug("ResourceManager : No configuration information found "+
- "for resource loader named '%s' (id is %s). Skipping it...",
+ "for resource loader named '{}' (id is {}). Skipping it...",
loaderName, loaderID);
continue;
}
@@ -448,7 +448,7 @@ public class ResourceManagerImpl
if (logWhenFound && log.isDebugEnabled())
{
- log.debug("ResourceManager: found %s with loader ",
+ log.debug("ResourceManager: found {} with loader {}",
resourceName, resourceLoader.getClassName());
}
@@ -536,7 +536,7 @@ public class ResourceManagerImpl
if (!org.apache.commons.lang3.StringUtils.equals(resource.getEncoding(), encoding))
{
- log.warn("Declared encoding for template '%s' is different on reload. Old = '%s' New = '%s'",
+ log.warn("Declared encoding for template '{}' is different on reload. Old = '{}' New = '{}'",
resource.getName(), resource.getEncoding(), encoding);
resource.setEncoding(encoding);
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
index e3852e19..f0e5d884 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
@@ -151,11 +151,8 @@ public class DataSourceResourceLoader extends ResourceLoader
{
if (log.isDebugEnabled())
{
- log.debug("DataSourceResourceLoader: using dataSource instance with table \""
- + tableName + "\"");
- log.debug("DataSourceResourceLoader: using columns \""
- + keyColumn + "\", \"" + templateColumn + "\" and \""
- + timestampColumn + "\"");
+ log.debug("DataSourceResourceLoader: using dataSource instance with table \"{}\"", tableName);
+ log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn);
}
log.trace("DataSourceResourceLoader initialized.");
@@ -164,11 +161,8 @@ public class DataSourceResourceLoader extends ResourceLoader
{
if (log.isDebugEnabled())
{
- log.debug("DataSourceResourceLoader: using \"" + dataSourceName
- + "\" datasource with table \"" + tableName + "\"");
- log.debug("DataSourceResourceLoader: using columns \""
- + keyColumn + "\", \"" + templateColumn + "\" and \""
- + timestampColumn + "\"");
+ log.debug("DataSourceResourceLoader: using \"{}\" datasource with table \"{}\"", dataSourceName, tableName);
+ log.debug("DataSourceResourceLoader: using columns \"{}\", \"{}\" and \"{}\"", keyColumn, templateColumn, timestampColumn);
}
log.trace("DataSourceResourceLoader initialized.");
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
index 8580caeb..86d33be0 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
@@ -85,7 +85,7 @@ public class FileResourceLoader extends ResourceLoader
if (log.isDebugEnabled())
{
- log.debug("Do unicode file recognition: " + unicode);
+ log.debug("Do unicode file recognition: {}", unicode);
}
if (log.isDebugEnabled())
@@ -97,7 +97,7 @@ public class FileResourceLoader extends ResourceLoader
int sz = paths.size();
for( int i=0; i < sz; i++)
{
- log.debug("FileResourceLoader : adding path '" + (String) paths.get(i) + "'");
+ log.debug("FileResourceLoader : adding path '{}'", (String)paths.get(i));
}
log.trace("FileResourceLoader : initialization complete.");
}
@@ -208,8 +208,7 @@ public class FileResourceLoader extends ResourceLoader
}
catch (Exception ioe)
{
- String msg = "Exception while checking for template " + name;
- log.debug(msg, ioe);
+ log.debug("Exception while checking for template {}", name);
}
}
return false;
@@ -247,7 +246,7 @@ public class FileResourceLoader extends ResourceLoader
if (log.isDebugEnabled())
{
- log.debug("File Encoding for " + file + " is: " + uis.getEncodingFromStream());
+ log.debug("File Encoding for {} is: {}", file, uis.getEncodingFromStream());
}
return new BufferedInputStream(uis);
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
index 7816871c..fa7e0476 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
@@ -61,7 +61,7 @@ public class JarHolder
if (log.isDebugEnabled())
{
- log.debug("JarHolder: initialized JAR: " + urlpath);
+ log.debug("JarHolder: initialized JAR: {}", urlpath);
}
}
@@ -74,7 +74,7 @@ public class JarHolder
{
if (log.isDebugEnabled())
{
- log.debug("JarHolder: attempting to connect to " + urlpath);
+ log.debug("JarHolder: attempting to connect to {}", urlpath);
}
URL url = new URL( urlpath );
conn = (JarURLConnection) url.openConnection();
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
index 23c6af2a..85f84cf3 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
@@ -94,7 +94,7 @@ public class JarResourceLoader extends ResourceLoader
if (paths != null)
{
- log.debug("JarResourceLoader # of paths : " + paths.size() );
+ log.debug("JarResourceLoader # of paths : {}", paths.size() );
for ( int i=0; i<paths.size(); i++ )
{
@@ -109,7 +109,7 @@ public class JarResourceLoader extends ResourceLoader
{
if (log.isDebugEnabled())
{
- log.debug("JarResourceLoader : trying to load \"" + path + "\"");
+ log.debug("JarResourceLoader : trying to load \"{}\"", path);
}
// Check path information
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
index c8386153..15fef7b3 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
@@ -228,9 +228,8 @@ public abstract class ResourceLoader
{
if (log.isDebugEnabled())
{
- log.debug("Could not load resource '" + resourceName
- + "' from ResourceLoader " + this.getClass().getName()
- + ": ", e);
+ log.debug("Could not load resource '{}' from ResourceLoader {}",
+ resourceName, this.getClass().getName(), e);
}
}
finally
@@ -246,8 +245,9 @@ public abstract class ResourceLoader
{
if (log.isErrorEnabled())
{
- String msg = "While closing InputStream for resource '" + resourceName
- + "' from ResourceLoader "+this.getClass().getName();
+ String msg = "While closing InputStream for resource '" +
+ resourceName + "' from ResourceLoader " +
+ this.getClass().getName();
log.error(msg, e);
throw new VelocityException(msg, e);
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
index e87ff9b4..97c52af7 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
@@ -224,7 +224,7 @@ public class StringResourceLoader extends ResourceLoader
this.repository = getRepository(repoName);
if (repository != null && log.isDebugEnabled())
{
- log.debug("Loaded repository '"+repoName+"' from static repo store");
+ log.debug("Loaded repository '{}' from static repo store", repoName);
}
}
else
@@ -232,7 +232,7 @@ public class StringResourceLoader extends ResourceLoader
this.repository = (StringResourceRepository)rsvc.getApplicationAttribute(repoName);
if (repository != null && log.isDebugEnabled())
{
- log.debug("Loaded repository '"+repoName+"' from application attributes");
+ log.debug("Loaded repository '{}' from application attributes", repoName);
}
}
@@ -257,9 +257,9 @@ public class StringResourceLoader extends ResourceLoader
// warn them if they are trying to change the class of the repository
if (!this.repository.getClass().getName().equals(repoClass))
{
- log.debug("Cannot change class of string repository '"+repoName+
- "' from "+this.repository.getClass().getName()+" to "+repoClass+
- ". The change will be ignored.");
+ log.debug("Cannot change class of string repository '{}' from {} to {}." +
+ " The change will be ignored.",
+ repoName, this.repository.getClass().getName(), repoClass);
}
// allow them to change the default encoding of the repo
@@ -268,8 +268,8 @@ public class StringResourceLoader extends ResourceLoader
{
if (log.isDebugEnabled())
{
- log.debug("Changing the default encoding of string repository '"+repoName+
- "' from "+this.repository.getEncoding()+" to "+encoding);
+ log.debug("Changing the default encoding of string repository '{}' from {} to {}",
+ repoName, this.repository.getEncoding(), encoding);
}
this.repository.setEncoding(encoding);
}
@@ -286,7 +286,7 @@ public class StringResourceLoader extends ResourceLoader
{
if (log.isDebugEnabled())
{
- log.debug("Creating string repository using class "+className+"...");
+ log.debug("Creating string repository using class {}...", className);
}
StringResourceRepository repo;
@@ -318,7 +318,7 @@ public class StringResourceLoader extends ResourceLoader
if (log.isDebugEnabled())
{
- log.debug("Default repository encoding is " + repo.getEncoding());
+ log.debug("Default repository encoding is {}", repo.getEncoding());
}
return repo;
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
index 207fc581..7b8324c4 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
@@ -58,7 +58,7 @@ public class URLResourceLoader extends ResourceLoader
{
for (int i=0; i < roots.length; i++)
{
- log.debug("URLResourceLoader : adding root '" + roots[i] + "'");
+ log.debug("URLResourceLoader : adding root '{}'", roots[i]);
}
}
@@ -71,7 +71,7 @@ public class URLResourceLoader extends ResourceLoader
Method conn = URLConnection.class.getMethod("setConnectTimeout", types);
Method read = URLConnection.class.getMethod("setReadTimeout", types);
timeoutMethods = new Method[] { conn, read };
- log.debug("URLResourceLoader : timeout set to "+timeout);
+ log.debug("URLResourceLoader : timeout set to {}", timeout);
}
catch (NoSuchMethodException nsme)
{
@@ -116,7 +116,7 @@ public class URLResourceLoader extends ResourceLoader
if (inputStream != null)
{
- if (log.isDebugEnabled()) log.debug("URLResourceLoader: Found '"+name+"' at '"+roots[i]+"'");
+ if (log.isDebugEnabled()) log.debug("URLResourceLoader: Found '{}' at '{}'", name, roots[i]);
// save this root for later re-use
templateRoots.put(name, roots[i]);
@@ -125,7 +125,7 @@ public class URLResourceLoader extends ResourceLoader
}
catch(IOException ioe)
{
- if (log.isDebugEnabled()) log.debug("URLResourceLoader: Exception when looking for '"+name+"' at '"+roots[i]+"'", ioe);
+ if (log.isDebugEnabled()) log.debug("URLResourceLoader: Exception when looking for '{}' at '{}'", name, roots[i], ioe);
// only save the first one for later throwing
if (exception == null)
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
index c3e27f35..f3015d97 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
@@ -57,7 +57,7 @@ public abstract class AbstractChainableUberspector extends UberspectImpl impleme
try {
this.inner.init();
} catch (Exception e) {
- this.log.error(e.getMessage(), e);
+ log.error(e.getMessage(), e);
this.inner = null;
}
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
index 8f34df8c..8d8b422a 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
@@ -70,7 +70,7 @@ public class ClassFieldMap
if (debugReflection && log.isDebugEnabled())
{
log.debug("=================================================================");
- log.debug("== Class: " + clazz);
+ log.debug("== Class: {}", clazz);
}
fieldCache = createFieldCache();
@@ -150,7 +150,7 @@ public class ClassFieldMap
{
if (debugReflection && log.isDebugEnabled())
{
- log.debug("Reflecting " + classToReflect);
+ log.debug("Reflecting {}", classToReflect);
}
try
@@ -169,7 +169,7 @@ public class ClassFieldMap
{
if (log.isDebugEnabled())
{
- log.debug("While accessing fields of " + classToReflect + ": ", se);
+ log.debug("While accessing fields of {}:", classToReflect, se);
}
}
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
index 6b2d41b1..552d4621 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
@@ -68,7 +68,7 @@ public class ClassMap
if (debugReflection && log.isDebugEnabled())
{
log.debug("=================================================================");
- log.debug("== Class: " + clazz);
+ log.debug("== Class: {}", clazz);
}
methodCache = createMethodCache();
@@ -159,7 +159,7 @@ public class ClassMap
{
if (debugReflection && log.isDebugEnabled())
{
- log.debug("Reflecting " + classToReflect);
+ log.debug("Reflecting {}", classToReflect);
}
try
@@ -178,7 +178,7 @@ public class ClassMap
{
if (log.isDebugEnabled())
{
- log.debug("While accessing methods of " + classToReflect + ": ", se);
+ log.debug("While accessing methods of {}:", classToReflect, se);
}
}
}
@@ -292,7 +292,7 @@ public class ClassMap
methodMap.add(method);
if (debugReflection && log.isDebugEnabled())
{
- log.debug("Adding " + method);
+ log.debug("Adding {}", method);
}
}
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
index 17ea9226..837bda9e 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
@@ -64,9 +64,8 @@ public class SecureIntrospectorImpl extends Introspector implements SecureIntros
{
if (!checkObjectExecutePermission(clazz, methodName))
{
- log.warn("Cannot retrieve method " + methodName +
- " from object of class " + clazz.getName() +
- " due to security restrictions.");
+ log.warn("Cannot retrieve method {} from object of class {} due to security restrictions."
+ , methodName, clazz.getName());
return null;
}
else
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
index 8a2f89ec..1a4e0ad9 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
@@ -84,8 +84,7 @@ public class SecureUberspector extends UberspectImpl implements RuntimeServicesA
}
else
{
- log.warn("Cannot retrieve iterator from " + obj.getClass() +
- " due to security restrictions.");
+ log.warn("Cannot retrieve iterator from {} due to security restrictions.", obj.getClass().getName());
}
}
return null;
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
index 37368842..533e0518 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
@@ -111,10 +111,10 @@ public class UberspectImpl implements Uberspect, UberspectLoggable
{
if (log.isDebugEnabled())
{
- log.debug("The iterative object in the #foreach() loop at " +
- i + " is of type java.util.Iterator. Because " +
- "it is not resettable, if used in more than once it " +
- "may lead to unexpected results.");
+ log.debug("The iterative object in the #foreach() loop at {}" +
+ " is of type java.util.Iterator. Because " +
+ "it is not resettable, if used in more than once it " +
+ "may lead to unexpected results.", i);
}
return ((Iterator) obj);
}
@@ -122,10 +122,10 @@ public class UberspectImpl implements Uberspect, UberspectLoggable
{
if (log.isDebugEnabled())
{
- log.debug("The iterative object in the #foreach() loop at " +
- i + " is of type java.util.Enumeration. Because " +
- "it is not resettable, if used in more than once it " +
- "may lead to unexpected results.");
+ log.debug("The iterative object in the #foreach() loop at {}" +
+ " is of type java.util.Enumeration. Because " +
+ "it is not resettable, if used in more than once it " +
+ "may lead to unexpected results.", i);
}
return new EnumerationIterator((Enumeration) obj);
}
@@ -157,8 +157,8 @@ public class UberspectImpl implements Uberspect, UberspectLoggable
}
else
{
- log.debug("iterator() method of reference in #foreach loop at "
- + i + " does not return a true Iterator.");
+ log.debug("iterator() method of reference in #foreach loop at " +
+ "{} does not return a true Iterator.", i);
}
}
catch (NoSuchMethodException nsme)
@@ -168,7 +168,7 @@ public class UberspectImpl implements Uberspect, UberspectLoggable
}
/* we have no clue what this is */
- log.debug("Could not determine type of iterator in #foreach loop at " + i);
+ log.debug("Could not determine type of iterator in #foreach loop at {}", i);
return null;
}