aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource
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/apache/velocity/runtime/resource
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/apache/velocity/runtime/resource')
-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
8 files changed, 34 insertions, 41 deletions
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)