velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r1749696 - in /velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity: runtime/ runtime/directive/ runtime/parser/node/ runtime/resource/ runtime/resource/loader/ util/introspection/
Date Wed, 22 Jun 2016 13:29:11 GMT
Author: cbrisson
Date: Wed Jun 22 13:29:11 2016
New Revision: 1749696

URL: http://svn.apache.org/viewvc?rev=1749696&view=rev
Log:
fix some parametrized logger messages for slf4j '{}' placeholders, and add parametrization
when possible

Modified:
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
Wed Jun 22 13:29:11 2016
@@ -427,7 +427,7 @@ public class RuntimeInstance implements
 
             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
         {
             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
             loadDirective(userdirective[i]);
             if (log.isDebugEnabled())
             {
-                log.debug("Loaded User Directive: " + userdirective[i]);
+                log.debug("Loaded User Directive: {}", userdirective[i]);
             }
         }
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroFactory.java
Wed Jun 22 13:29:11 2016
@@ -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

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Block.java
Wed Jun 22 13:29:11 2016
@@ -84,9 +84,8 @@ public abstract class Block extends Dire
         }
         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 Dire
                  * 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;
             }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTReference.java
Wed Jun 22 13:29:11 2016
@@ -428,8 +428,9 @@ public class ASTReference extends Simple
             {
                 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 Simple
 
             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 Simple
 
         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 Simple
                         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 Simple
         }
         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 Simple
         {
           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());
           

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
Wed Jun 22 13:29:11 2016
@@ -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);
             }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/DataSourceResourceLoader.java
Wed Jun 22 13:29:11 2016
@@ -151,11 +151,8 @@ public class DataSourceResourceLoader ex
         {
             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 ex
         {
             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.");

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/FileResourceLoader.java
Wed Jun 22 13:29:11 2016
@@ -85,7 +85,7 @@ public class FileResourceLoader extends
 
         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
             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
             }
             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
 
                             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);

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarHolder.java
Wed Jun 22 13:29:11 2016
@@ -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();

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/JarResourceLoader.java
Wed Jun 22 13:29:11 2016
@@ -94,7 +94,7 @@ public class JarResourceLoader extends R
 
         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 R
     {
         if (log.isDebugEnabled())
         {
-            log.debug("JarResourceLoader : trying to load \"" + path + "\"");
+            log.debug("JarResourceLoader : trying to load \"{}\"", path);
         }
 
         // Check path information

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/ResourceLoader.java
Wed Jun 22 13:29:11 2016
@@ -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);
                 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/StringResourceLoader.java
Wed Jun 22 13:29:11 2016
@@ -224,7 +224,7 @@ public class StringResourceLoader extend
             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 extend
             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 extend
             // 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 extend
             {
                 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 extend
     {
         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 extend
 
         if (log.isDebugEnabled())
         {
-            log.debug("Default repository encoding is " + repo.getEncoding());
+            log.debug("Default repository encoding is {}", repo.getEncoding());
         }
         return repo;
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/loader/URLResourceLoader.java
Wed Jun 22 13:29:11 2016
@@ -58,7 +58,7 @@ public class URLResourceLoader extends R
         {
             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 R
                 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 R
 
                 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 R
             }
             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)

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/AbstractChainableUberspector.java
Wed Jun 22 13:29:11 2016
@@ -57,7 +57,7 @@ public abstract class AbstractChainableU
             try {
                 this.inner.init();
             } catch (Exception e) {
-                this.log.error(e.getMessage(), e);
+                log.error(e.getMessage(), e);
                 this.inner = null;
             }
         }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassFieldMap.java
Wed Jun 22 13:29:11 2016
@@ -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);
             }
         }
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ClassMap.java
Wed Jun 22 13:29:11 2016
@@ -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);
                 }
             }
         }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorImpl.java
Wed Jun 22 13:29:11 2016
@@ -64,9 +64,8 @@ public class SecureIntrospectorImpl exte
     {
         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

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureUberspector.java
Wed Jun 22 13:29:11 2016
@@ -84,8 +84,7 @@ public class SecureUberspector extends U
             }
             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;

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java?rev=1749696&r1=1749695&r2=1749696&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
(original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
Wed Jun 22 13:29:11 2016
@@ -111,10 +111,10 @@ public class UberspectImpl implements Ub
         {
             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 Ub
         {
             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 Ub
                 }
                 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 Ub
         }
 
         /*  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;
     }




Mime
View raw message