velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cbris...@apache.org
Subject svn commit: r1780734 [1/4] - in /velocity/engine/trunk: ./ velocity-engine-core/src/main/java/org/apache/velocity/ velocity-engine-core/src/main/java/org/apache/velocity/app/ velocity-engine-core/src/main/java/org/apache/velocity/app/event/ velocity-en...
Date Sat, 28 Jan 2017 19:21:10 GMT
Author: cbrisson
Date: Sat Jan 28 19:21:08 2017
New Revision: 1780734

URL: http://svn.apache.org/viewvc?rev=1780734&view=rev
Log:
[engine] full code review (foreach loops and some other problems detected by code analysis tools)

Modified:
    velocity/engine/trunk/README.md
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalEventContext.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/Filter.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/VelocityWriter.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
    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/RuntimeServices.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.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/VelocimacroManager.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/DirectiveConstants.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Evaluate.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Macro.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/MacroParseException.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Scope.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/ParseException.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/TemplateParseException.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComparisonNode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIndex.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTNotNode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTOrNode.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/parser/node/ASTSetDirective.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapGetExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapSetExecutor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/Node.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCache.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCacheImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceManager.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/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/URLResourceLoader.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ArrayIterator.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ClassUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ContextAware.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/DuckType.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/ExtProperties.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/RuntimeServicesAware.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/StringUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateBoolean.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateNumber.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/TemplateString.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ChainableUberspector.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/ConversionHandler.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/ConversionHandlerImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/IntrospectionUtils.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/MethodMap.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/SecureIntrospectorControl.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/Uberspect.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/UberspectImpl.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/VelMethod.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/VelPropertyGet.java
    velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/util/introspection/VelPropertySet.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ArithmeticTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ArrayMethodsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BaseTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/BuiltInEventHandlerTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/CommonsExtPropTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/EvaluateTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ForeachTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IncludeErrorTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IndexTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/InfoTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/Introspector3TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/IntrospectorTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/InvalidEventHandlerTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MethodCacheKeyTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MethodInvocationExceptionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MethodOverloadingTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/MiscTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/NumberMethodCallsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ParseWithMacroLibsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ParserTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/RenderVelocityTemplateTest.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/ResourceLoaderInstanceTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/SecureIntrospectionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StrictCompareTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StrictMathTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/StringResourceLoaderTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestBase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/TemplateTestSuite.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/URLResourceLoaderTimeoutTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/VarargMethodsTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/VelocimacroTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/VelTools66TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity544TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity579TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity62TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity689TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity701TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/issues/Velocity753TestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/misc/TestContext.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/provider/TestNumber.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/provider/TestProvider.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/ConversionHandlerTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/test/util/introspection/EnumConstantConversionTestCase.java
    velocity/engine/trunk/velocity-engine-core/src/test/java/org/apache/velocity/util/SimplePoolTestCase.java
    velocity/engine/trunk/velocity-engine-examples/src/main/java/org/apache/velocity/example/DBContext.java
    velocity/engine/trunk/velocity-engine-examples/src/main/java/org/apache/velocity/example/EventExample.java
    velocity/engine/trunk/velocity-engine-examples/src/main/java/org/apache/velocity/example/Example.java
    velocity/engine/trunk/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngine.java
    velocity/engine/trunk/velocity-engine-scripting/src/main/java/org/apache/velocity/script/VelocityScriptEngineFactory.java

Modified: velocity/engine/trunk/README.md
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/README.md?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/README.md (original)
+++ velocity/engine/trunk/README.md Sat Jan 28 19:21:08 2017
@@ -48,7 +48,7 @@ updates.
 * velocity is now using the SLF4J logging facade. Hence, all methods accepting
 or returning a logger now use the org.slf4j.Logger object. Velocity uses a
 logger name of org.apache.velocity (configurable with the runtime.log.name
-configuration entry), and several other childen loggers.
+configuration entry), and several other children loggers.
 * the internal Context API now enforces String keys everywhere, this may break
 custom Context implementations at compile-time.
 * invalid reference events are now more sparsely sent; they're not sent if any
@@ -71,7 +71,7 @@ encoding).
 providing template name and location infos.
 * Initialization methods in Velocity and VelocityEngine taking an
 ExtendedProperties have been removed (but setProperties(Properties) methods
-are still here). All occurences of the
+are still here). All occurrences of the
 org.apache.commons.collections.ExtendedProperties class in the runtime
 internal initialization API have been replaced by
 org.apache.velocity.util.ExtProperties.
@@ -170,11 +170,11 @@ WEB-INF/lib directory.
 
 ## TRYING THE EXAMPLES
 
-After building Velocity, you can also buld the examples that are
+After building Velocity, you can also build the examples that are
 included with the Velocity distribution. These examples show how to
 use Velocity in your Java applications.
 
 For more information, please see the README.txt in the
-velocity-engine-exemples/src/etc/ directory.
+velocity-engine-examples/src/etc/ directory.
 
 - The Apache Velocity Team

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/Template.java Sat Jan 28 19:21:08 2017
@@ -202,7 +202,7 @@ public class Template extends Resource
     /**
      *  initializes the document.  init() is not longer
      *  dependant upon context, but we need to let the
-     *  init() carry the template name down throught for VM
+     *  init() carry the template name down through for VM
      *  namespace features
      * @throws TemplateInitException When a problem occurs during the document initialization.
      */
@@ -250,7 +250,7 @@ public class Template extends Resource
      * The AST node structure is merged with the
      * context to produce the final output.
      *
-     *  @param context Conext with data elements accessed by template
+     *  @param context Context with data elements accessed by template
      *  @param writer output writer for rendered template
      *  @throws ResourceNotFoundException if template not found
      *          from any available source.
@@ -269,7 +269,7 @@ public class Template extends Resource
      * The AST node structure is merged with the
      * context to produce the final output.
      *
-     *  @param context Conext with data elements accessed by template
+     *  @param context Context with data elements accessed by template
      *  @param writer output writer for rendered template
      *  @param macroLibraries a list of template files containing macros to be used when merging
      *  @throws ResourceNotFoundException if template not found
@@ -310,14 +310,14 @@ public class Template extends Resource
 
             if (macroLibraries != null)
             {
-                for (int i = 0; i < macroLibraries.size(); i++)
+                for (String macroLibrary : (List<String>)macroLibraries)
                 {
                     /**
                      * Build the macro library
                      */
                     try
                     {
-                        Template t = rsvc.getTemplate((String) macroLibraries.get(i));
+                        Template t = rsvc.getTemplate(macroLibrary);
                         libTemplates.add(t);
                     }
                     catch (ResourceNotFoundException re)
@@ -326,7 +326,7 @@ public class Template extends Resource
                         * the macro lib wasn't found.  Note it and throw
                         */
                         log.error("template.merge(): cannot find template {}",
-                                  (String)macroLibraries.get(i));
+                            macroLibrary);
                         throw re;
                     }
                     catch (ParseErrorException pe)
@@ -336,14 +336,14 @@ public class Template extends Resource
                         *  note it and throw
                         */
                         rsvc.getLog("parser").error("template.merge(): syntax error in template {}: {}",
-                                                    (String)macroLibraries.get(i), pe.getMessage(), pe);
+                            macroLibrary, pe.getMessage(), pe);
                         throw pe;
                     }
 
                     catch (Exception e)
                     {
                         throw new RuntimeException("Template.merge(): parse failed in template  " +
-                                (String) macroLibraries.get(i) + ".", e);
+                            (String) macroLibrary + ".", e);
                     }
                 }
             }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/VelocityContext.java Sat Jan 28 19:21:08 2017
@@ -177,7 +177,7 @@ public class VelocityContext extends Abs
         try
         {
             clone = (VelocityContext) super.clone();
-            clone.context = new HashMap<String, Object>(context);
+            clone.context = new HashMap<>(context);
         }
         catch (CloneNotSupportedException ignored)
         {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/FieldMethodizer.java Sat Jan 28 19:21:08 2017
@@ -170,15 +170,15 @@ public class FieldMethodizer
     private void inspect(Class clas)
     {
         Field[] fields = clas.getFields();
-        for( int i = 0; i < fields.length; i++)
+        for (Field field : fields)
         {
             /*
              *  only if public and static
              */
-            int mod = fields[i].getModifiers();
-            if ( Modifier.isStatic(mod) && Modifier.isPublic(mod) )
+            int mod = field.getModifiers();
+            if (Modifier.isStatic(mod) && Modifier.isPublic(mod))
             {
-                fieldHash.put(fields[i].getName(), fields[i]);
+                fieldHash.put(field.getName(), field);
             }
         }
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/VelocityEngine.java Sat Jan 28 19:21:08 2017
@@ -329,7 +329,7 @@ public class VelocityEngine implements R
      *   cannot be used to pre-load the resource cache, as the
      *   previous implementation did as a side-effect.
      *   <br><br>
-     *   The previous implementation exhibited extreme lazyness and
+     *   The previous implementation exhibited extreme laziness and
      *   sloth, and the author has been flogged.
      *
      *   @param resourceName  name of the resource to search for

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/IncludeEventHandler.java Sat Jan 28 19:21:08 2017
@@ -48,5 +48,5 @@ public interface  IncludeEventHandler ex
      * @return a new resource path for the directive, or null to block the
      *         include from occurring.
      */
-    public String includeEvent(Context context, String includeResourcePath, String currentResourcePath, String directiveName);
+    String includeEvent(Context context, String includeResourcePath, String currentResourcePath, String directiveName);
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/InvalidReferenceEventHandler.java Sat Jan 28 19:21:08 2017
@@ -50,8 +50,8 @@ public interface InvalidReferenceEventHa
      * @param info contains template, line, column details
      * @return substitute return value for missing reference, or null if no substitute
      */
-    public Object invalidGetMethod(Context context, String reference,
-            Object object, String property, Info info);
+    Object invalidGetMethod(Context context, String reference,
+                            Object object, String property, Info info);
 
     /**
      * Called when object is null or there is no setter for the given
@@ -68,8 +68,8 @@ public interface InvalidReferenceEventHa
      * @return if true then stop calling invalidSetMethod along the
      * chain.
      */
-    public boolean invalidSetMethod(Context context, String leftreference,
-            String rightreference, Info info);
+    boolean invalidSetMethod(Context context, String leftreference,
+                             String rightreference, Info info);
 
     /**
      * Called when object is null or the given method does not exist.
@@ -83,6 +83,6 @@ public interface InvalidReferenceEventHa
      * @param info contains template, line, column details
      * @return substitute return value for missing reference, or null if no substitute
      */
-    public Object invalidMethod(Context context, String reference,
-            Object object, String method, Info info);
+    Object invalidMethod(Context context, String reference,
+                         Object object, String method, Info info);
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/MethodExceptionEventHandler.java Sat Jan 28 19:21:08 2017
@@ -48,5 +48,5 @@ public interface MethodExceptionEventHan
      * @return an object to insert in the page
      * @throws RuntimeException an exception to be thrown instead inserting an object
      */
-    public Object methodException(Context context, Class claz, String method, Exception e, Info info);
+    Object methodException(Context context, Class claz, String method, Exception e, Info info);
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/ReferenceInsertionEventHandler.java Sat Jan 28 19:21:08 2017
@@ -48,6 +48,6 @@ public interface  ReferenceInsertionEven
      * @return Object on which <code>toString()</code> should be called for
      *         output.
      */
-    public Object referenceInsert( Context context, String reference, Object value  );
+    Object referenceInsert(Context context, String reference, Object value);
 
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/app/event/implement/PrintExceptions.java Sat Jan 28 19:21:08 2017
@@ -35,7 +35,7 @@ import java.io.StringWriter;
  * <P>By default this event handler renders an error message containing the class and method which generated
  * the exception, the exception name and its message.
  *
- * To render the reference and the location in the tempkate, set the property <code>eventhandler.methodexception.templateinfo</code>
+ * To render the reference and the location in the template, set the property <code>eventhandler.methodexception.templateinfo</code>
  * to <code>true</code>.
  *
  * To render the stack trace, set the property <code>eventhandler.methodexception.stacktrace</code>

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/AbstractContext.java Sat Jan 28 19:21:08 2017
@@ -163,9 +163,9 @@ public abstract class AbstractContext ex
 
         /*
          * We always use string interning here:
-         * 1) speed is générally less critical when populating the context than during parsing or rendering
+         * 1) speed is generally less critical when populating the context than during parsing or rendering
          * 2) a context key is very likely to be used several times, or even a lot of times, in the template (but does it save memory if runtime.string.interning is false?)
-         * 3) last but not least: we don't have access to RuntimeServices from here, the reenginering would be painful...
+         * 3) last but not least: we don't have access to RuntimeServices from here, the reengineering would be painful...
          */
         return internalPut(key.intern(), value);
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalContextBase.java Sat Jan 28 19:21:08 2017
@@ -57,12 +57,12 @@ class InternalContextBase implements Int
     /**
      *  Template name stack. The stack top contains the current template name.
      */
-    private Stack<String> templateNameStack = new Stack<String>();
+    private Stack<String> templateNameStack = new Stack<>();
 
     /**
      *  Velocimacro name stack. The stack top contains the current macro name.
      */
-    private Stack<String> macroNameStack = new Stack<String>();
+    private Stack<String> macroNameStack = new Stack<>();
 
     /**
      *  EventCartridge we are to carry.  Set by application

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalEventContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalEventContext.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalEventContext.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/context/InternalEventContext.java Sat Jan 28 19:21:08 2017
@@ -35,10 +35,10 @@ public interface InternalEventContext
      * @param ec
      * @return The old EventCartridge.
      */
-    public EventCartridge attachEventCartridge( EventCartridge ec);
+    EventCartridge attachEventCartridge(EventCartridge ec);
 
     /**
      * @return The current EventCartridge.
      */
-    public EventCartridge getEventCartridge();
+    EventCartridge getEventCartridge();
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/Filter.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/Filter.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/Filter.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/Filter.java Sat Jan 28 19:21:08 2017
@@ -28,5 +28,5 @@ import java.io.IOException;
 
 public interface Filter
 {
-    public void writeReference(String ref) throws IOException;
+    void writeReference(String ref) throws IOException;
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/UnicodeInputStream.java Sat Jan 28 19:21:08 2017
@@ -194,7 +194,7 @@ public class UnicodeInputStream
         return (encoding != null) ? encoding.getEncoding() : null;
     }
 
-    private final UnicodeBOM match(final UnicodeBOM matchEncoding, final UnicodeBOM noMatchEncoding)
+    private UnicodeBOM match(final UnicodeBOM matchEncoding, final UnicodeBOM noMatchEncoding)
         throws IOException
     {
         byte [] bom = matchEncoding.getBytes();
@@ -218,7 +218,7 @@ public class UnicodeInputStream
         return matchEncoding;
     }
 
-    private final boolean readByte()
+    private boolean readByte()
             throws IOException
     {
         int res = inputStream.read();
@@ -236,7 +236,7 @@ public class UnicodeInputStream
         return true;
     }
 
-    private final void pushback(final UnicodeBOM matchBOM)
+    private void pushback(final UnicodeBOM matchBOM)
         throws IOException
     {
         int count = pos; // By default, all bytes are pushed back.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/VelocityWriter.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/VelocityWriter.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/VelocityWriter.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/io/VelocityWriter.java Sat Jan 28 19:21:08 2017
@@ -120,7 +120,7 @@ public final class VelocityWriter extend
      * flushing the stream itself.  This method is non-private only so that it
      * may be invoked by PrintStream.
      */
-    private final void flushBuffer() throws IOException
+    private void flushBuffer() throws IOException
     {
         if (bufferSize == 0)
             return;
@@ -138,7 +138,7 @@ public final class VelocityWriter extend
         nextChar = 0;
     }
 
-    private final void bufferOverflow() throws IOException
+    private void bufferOverflow() throws IOException
     {
         throw new IOException("overflow");
     }
@@ -204,7 +204,7 @@ public final class VelocityWriter extend
      * <code>java.lang.Math</code> if we've run out of file
      * descriptors and we're trying to print a stack trace.
      */
-    private final int min(int a, int b)
+    private int min(int a, int b)
     {
 	    return (a < b ? a : b);
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/Renderable.java Sat Jan 28 19:21:08 2017
@@ -38,7 +38,7 @@ import java.io.Writer;
 
 public interface Renderable {
 
-    public boolean render( InternalContextAdapter context, Writer writer)
+    boolean render(InternalContextAdapter context, Writer writer)
         throws IOException, MethodInvocationException, ParseErrorException, ResourceNotFoundException;
 
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java Sat Jan 28 19:21:08 2017
@@ -289,7 +289,7 @@ public interface RuntimeConstants
     /**
      * Space gobbling modes
      */
-    public enum SpaceGobbling
+    enum SpaceGobbling
     {
         NONE, BC, LINES, STRUCTURED
     }

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=1780734&r1=1780733&r2=1780734&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 Sat Jan 28 19:21:08 2017
@@ -361,14 +361,13 @@ public class RuntimeInstance implements
     private void initializeIntrospection()
     {
         String[] uberspectors = configuration.getStringArray(RuntimeConstants.UBERSPECT_CLASSNAME);
-        for (int i=0; i <uberspectors.length;i++)
+        for (String rm : uberspectors)
         {
-            String rm = uberspectors[i];
             Object o = null;
 
             try
             {
-               o = ClassUtils.getNewInstance( rm );
+                o = ClassUtils.getNewInstance(rm);
             }
             catch (ClassNotFoundException cnfe)
             {
@@ -379,11 +378,11 @@ public class RuntimeInstance implements
             }
             catch (InstantiationException ie)
             {
-              throw new VelocityException("Could not instantiate class '" + rm + "'", ie);
+                throw new VelocityException("Could not instantiate class '" + rm + "'", ie);
             }
             catch (IllegalAccessException ae)
             {
-              throw new VelocityException("Cannot access class '" + rm + "'", ae);
+                throw new VelocityException("Cannot access class '" + rm + "'", ae);
             }
 
             if (!(o instanceof Uberspect))
@@ -396,27 +395,25 @@ public class RuntimeInstance implements
                 throw new VelocityException(err);
             }
 
-            Uberspect u = (Uberspect)o;
+            Uberspect u = (Uberspect) o;
 
             if (u instanceof RuntimeServicesAware)
             {
-                ((RuntimeServicesAware)u).setRuntimeServices(this);
+                ((RuntimeServicesAware) u).setRuntimeServices(this);
             }
 
             if (uberSpect == null)
             {
                 uberSpect = u;
-            }
-            else
+            } else
             {
                 if (u instanceof ChainableUberspector)
                 {
-                    ((ChainableUberspector)u).wrap(uberSpect);
+                    ((ChainableUberspector) u).wrap(uberSpect);
                     uberSpect = u;
-                }
-                else
+                } else
                 {
-                    uberSpect = new LinkingUberspector(uberSpect,u);
+                    uberSpect = new LinkingUberspector(uberSpect, u);
                 }
             }
         }
@@ -797,9 +794,9 @@ public class RuntimeInstance implements
         String[] referenceinsertion = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION);
         if ( referenceinsertion != null )
         {
-            for ( int i=0; i < referenceinsertion.length; i++ )
+            for (String aReferenceinsertion : referenceinsertion)
             {
-                EventHandler ev = initializeSpecificEventHandler(referenceinsertion[i],RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION,ReferenceInsertionEventHandler.class);
+                EventHandler ev = initializeSpecificEventHandler(aReferenceinsertion, RuntimeConstants.EVENTHANDLER_REFERENCEINSERTION, ReferenceInsertionEventHandler.class);
                 if (ev != null)
                     eventCartridge.addReferenceInsertionEventHandler((ReferenceInsertionEventHandler) ev);
             }
@@ -808,9 +805,9 @@ public class RuntimeInstance implements
         String[] methodexception = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_METHODEXCEPTION);
         if ( methodexception != null )
         {
-            for ( int i=0; i < methodexception.length; i++ )
+            for (String aMethodexception : methodexception)
             {
-                EventHandler ev = initializeSpecificEventHandler(methodexception[i],RuntimeConstants.EVENTHANDLER_METHODEXCEPTION,MethodExceptionEventHandler.class);
+                EventHandler ev = initializeSpecificEventHandler(aMethodexception, RuntimeConstants.EVENTHANDLER_METHODEXCEPTION, MethodExceptionEventHandler.class);
                 if (ev != null)
                     eventCartridge.addMethodExceptionHandler((MethodExceptionEventHandler) ev);
             }
@@ -819,9 +816,9 @@ public class RuntimeInstance implements
         String[] includeHandler = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_INCLUDE);
         if ( includeHandler != null )
         {
-            for ( int i=0; i < includeHandler.length; i++ )
+            for (String anIncludeHandler : includeHandler)
             {
-                EventHandler ev = initializeSpecificEventHandler(includeHandler[i],RuntimeConstants.EVENTHANDLER_INCLUDE,IncludeEventHandler.class);
+                EventHandler ev = initializeSpecificEventHandler(anIncludeHandler, RuntimeConstants.EVENTHANDLER_INCLUDE, IncludeEventHandler.class);
                 if (ev != null)
                     eventCartridge.addIncludeEventHandler((IncludeEventHandler) ev);
             }
@@ -830,9 +827,9 @@ public class RuntimeInstance implements
         String[] invalidReferenceSet = configuration.getStringArray(RuntimeConstants.EVENTHANDLER_INVALIDREFERENCES);
         if ( invalidReferenceSet != null )
         {
-            for ( int i=0; i < invalidReferenceSet.length; i++ )
+            for (String anInvalidReferenceSet : invalidReferenceSet)
             {
-                EventHandler ev = initializeSpecificEventHandler(invalidReferenceSet[i],RuntimeConstants.EVENTHANDLER_INVALIDREFERENCES,InvalidReferenceEventHandler.class);
+                EventHandler ev = initializeSpecificEventHandler(anInvalidReferenceSet, RuntimeConstants.EVENTHANDLER_INVALIDREFERENCES, InvalidReferenceEventHandler.class);
                 if (ev != null)
                 {
                     eventCartridge.addInvalidReferenceEventHandler((InvalidReferenceEventHandler) ev);
@@ -1024,10 +1021,10 @@ public class RuntimeInstance implements
 
         String[] userdirective = configuration.getStringArray("userdirective");
 
-        for( int i = 0; i < userdirective.length; i++)
+        for (String anUserdirective : userdirective)
         {
-            loadDirective(userdirective[i]);
-            log.debug("Loaded User Directive: {}", userdirective[i]);
+            loadDirective(anUserdirective);
+            log.debug("Loaded User Directive: {}", anUserdirective);
         }
 
     }
@@ -1072,8 +1069,7 @@ public class RuntimeInstance implements
      */
     private void updateSharedDirectivesMap()
     {
-        Map tmp = new HashMap(runtimeDirectives);
-        runtimeDirectivesShared = tmp;
+        runtimeDirectivesShared = new HashMap(runtimeDirectives);
     }
 
     /**
@@ -1192,8 +1188,7 @@ public class RuntimeInstance implements
     {
         requireInitialization();
 
-        Parser parser = new Parser(this);
-        return parser;
+        return new Parser(this);
     }
 
     /**
@@ -1218,7 +1213,7 @@ public class RuntimeInstance implements
     {
         requireInitialization();
 
-        Parser parser = (Parser) parserPool.get();
+        Parser parser = parserPool.get();
         boolean keepParser = true;
         if (parser == null)
         {
@@ -1501,11 +1496,11 @@ public class RuntimeInstance implements
         StringBuilder template = new StringBuilder("#");
         template.append(vmName);
         template.append("(");
-        for( int i = 0; i < params.length; i++)
-        {
-            template.append(" $");
-            template.append(params[i]);
-        }
+         for (String param : params)
+         {
+             template.append(" $");
+             template.append(param);
+         }
         template.append(" )");
 
         return evaluate(context, writer, logTag, template.toString());

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java Sat Jan 28 19:21:08 2017
@@ -71,7 +71,7 @@ public interface RuntimeServices
      *   <li>Velocimacro System</li>
      * </ul>
      */
-    public void init();
+   void init();
 
     /**
      * Allows an external system to set a property in
@@ -80,7 +80,7 @@ public interface RuntimeServices
      * @param key property key
      * @param value property value
      */
-    public  void setProperty(String key, Object value);
+    void setProperty(String key, Object value);
 
     /**
      * Allow an external system to set an ExtProperties
@@ -89,7 +89,7 @@ public interface RuntimeServices
      * @param configuration
      * @since 2.0
      */
-    public void setConfiguration( ExtProperties configuration);
+    void setConfiguration(ExtProperties configuration);
 
  /**
      * Add a property to the configuration. If it already
@@ -110,7 +110,7 @@ public interface RuntimeServices
      * @param key
      * @param value
      */
-    public void addProperty(String key, Object value);
+ void addProperty(String key, Object value);
 
     /**
      * Clear the values pertaining to a particular
@@ -118,7 +118,7 @@ public interface RuntimeServices
      *
      * @param key of property to clear
      */
-    public void clearProperty(String key);
+    void clearProperty(String key);
 
     /**
      *  Allows an external caller to get a property.  The calling
@@ -128,7 +128,7 @@ public interface RuntimeServices
      *  @param key property to return
      * @return The value.
      */
-    public  Object getProperty( String key );
+    Object getProperty(String key);
 
     /**
      * Initialize the Velocity Runtime with a Properties
@@ -136,7 +136,7 @@ public interface RuntimeServices
      *
      * @param p
      */
-    public void init(Properties p);
+    void init(Properties p);
 
     /**
      * Initialize the Velocity Runtime with the name of
@@ -144,7 +144,7 @@ public interface RuntimeServices
      *
      * @param configurationFile
      */
-    public void init(String configurationFile);
+    void init(String configurationFile);
 
     /**
      * Parse the input and return the root of
@@ -163,7 +163,7 @@ public interface RuntimeServices
      * @return The AST representing the template.
      * @throws ParseException
      */
-    public  SimpleNode parse( Reader reader, Template template )
+    SimpleNode parse(Reader reader, Template template)
         throws ParseException;
 
     /**
@@ -185,8 +185,8 @@ public interface RuntimeServices
      * @throws IOException While rendering to the writer, an I/O problem occurred.
      * @since Velocity 1.6
      */
-    public boolean evaluate(Context context, Writer out,
-                            String logTag, String instring);
+    boolean evaluate(Context context, Writer out,
+                     String logTag, String instring);
 
     /**
      * Renders the input reader using the context into the output writer.
@@ -206,8 +206,8 @@ public interface RuntimeServices
      * @throws ResourceNotFoundException A referenced resource could not be loaded.
      * @since Velocity 1.6
      */
-    public boolean evaluate(Context context, Writer writer,
-                            String logTag, Reader reader);
+    boolean evaluate(Context context, Writer writer,
+                     String logTag, Reader reader);
 
     /**
      * Invokes a currently registered Velocimacro with the params provided
@@ -225,9 +225,9 @@ public interface RuntimeServices
      * @return true if Velocimacro exists and successfully invoked, false otherwise.
      * @since 1.6
      */
-    public boolean invokeVelocimacro(final String vmName, String logTag,
-                                     String[] params, final Context context,
-                                     final Writer writer);
+    boolean invokeVelocimacro(final String vmName, String logTag,
+                              String[] params, final Context context,
+                              final Writer writer);
 
     /**
      * Returns a <code>Template</code> from the resource manager.
@@ -242,7 +242,7 @@ public interface RuntimeServices
      * @throws ParseErrorException if template cannot be parsed due
      *          to syntax (or other) error.
      */
-    public Template getTemplate(String name)
+    Template getTemplate(String name)
         throws ResourceNotFoundException, ParseErrorException;
 
     /**
@@ -256,7 +256,7 @@ public interface RuntimeServices
      * @throws ParseErrorException if template cannot be parsed due
      *          to syntax (or other) error.
      */
-    public Template getTemplate(String name, String  encoding)
+    Template getTemplate(String name, String encoding)
         throws ResourceNotFoundException, ParseErrorException;
 
     /**
@@ -270,7 +270,7 @@ public interface RuntimeServices
      *          from any available source.
      * @throws ParseErrorException
      */
-    public ContentResource getContent(String name)
+    ContentResource getContent(String name)
         throws ResourceNotFoundException, ParseErrorException;
 
     /**
@@ -284,7 +284,7 @@ public interface RuntimeServices
      *          from any available source.
      * @throws ParseErrorException
      */
-    public ContentResource getContent( String name, String encoding )
+    ContentResource getContent(String name, String encoding)
         throws ResourceNotFoundException, ParseErrorException;
 
     /**
@@ -296,7 +296,7 @@ public interface RuntimeServices
      *  @param resourceName Name of template or content resource
      *  @return class name of loader than can provide it
      */
-    public String getLoaderNameForResource( String resourceName );
+    String getLoaderNameForResource(String resourceName);
 
     /**
      * String property accessor method with default to hide the
@@ -307,7 +307,7 @@ public interface RuntimeServices
      *               found in resource manager.
      * @return String  value of key or default
      */
-    public String getString( String key, String defaultValue);
+    String getString(String key, String defaultValue);
 
     /**
      * Returns the appropriate VelocimacroProxy object if strVMname
@@ -321,7 +321,7 @@ public interface RuntimeServices
      *
      * @return VelocimacroProxy
      */
-    public Directive getVelocimacro(String vmName, Template renderingTemplate, Template template);
+    Directive getVelocimacro(String vmName, Template renderingTemplate, Template template);
 
     /**
      * Adds a new Velocimacro. Usually called by Macro only while parsing.
@@ -335,10 +335,10 @@ public interface RuntimeServices
      * @return boolean  True if added, false if rejected for some
      *                  reason (either parameters or permission settings)
      */
-    public boolean addVelocimacro( String name,
-                                   Node macro,
-                                   List<Macro.MacroArg> macroArgs,
-                                   Template definingTemplate );
+    boolean addVelocimacro(String name,
+                           Node macro,
+                           List<Macro.MacroArg> macroArgs,
+                           Template definingTemplate);
 
 
     /**
@@ -348,14 +348,14 @@ public interface RuntimeServices
      * @param template Template "namespace"
      * @return boolean  True if VM by that name exists, false if not
      */
-    public boolean isVelocimacro(String vmName, Template template);
+    boolean isVelocimacro(String vmName, Template template);
 
     /**
      * String property accessor method to hide the configuration implementation
      * @param key  property key
      * @return   value of key or null
      */
-    public String getString(String key);
+    String getString(String key);
 
     /**
      * Int property accessor method to hide the configuration implementation.
@@ -363,7 +363,7 @@ public interface RuntimeServices
      * @param key property key
      * @return int value
      */
-    public int getInt( String key );
+    int getInt(String key);
 
     /**
      * Int property accessor method to hide the configuration implementation.
@@ -372,7 +372,7 @@ public interface RuntimeServices
      * @param defaultValue default value
      * @return int  value
      */
-    public int getInt( String key, int defaultValue );
+    int getInt(String key, int defaultValue);
 
     /**
      * Boolean property accessor method to hide the configuration implementation.
@@ -381,7 +381,7 @@ public interface RuntimeServices
      * @param def default default value if property not found
      * @return boolean  value of key or default value
      */
-    public boolean getBoolean( String key, boolean def );
+    boolean getBoolean(String key, boolean def);
 
     /**
      * Return the velocity runtime configuration object.
@@ -389,7 +389,7 @@ public interface RuntimeServices
      * @return ExtProperties configuration object which houses
      *                       the velocity runtime properties.
      */
-    public ExtProperties getConfiguration();
+    ExtProperties getConfiguration();
 
     /**
      * Return the specified application attribute.
@@ -397,7 +397,7 @@ public interface RuntimeServices
      * @param key The name of the attribute to retrieve.
      * @return The value of the attribute.
      */
-    public Object getApplicationAttribute( Object key );
+    Object getApplicationAttribute(Object key);
 
     /**
      * Set the specified application attribute.
@@ -406,20 +406,20 @@ public interface RuntimeServices
      * @param value The attribute value to set.
      * @return the displaced attribute value
      */
-    public Object setApplicationAttribute( Object key, Object value );
+    Object setApplicationAttribute(Object key, Object value);
 
     /**
      * Returns the configured class introspection/reflection
      * implementation.
      * @return The current Uberspect object.
      */
-    public Uberspect getUberspect();
+    Uberspect getUberspect();
 
     /**
      * Returns a convenient Log instance that wraps the current LogChute.
      * @return A log object.
      */
-    public Logger getLog();
+    Logger getLog();
 
     /**
      * Get a logger for the specified child namespace.
@@ -428,25 +428,25 @@ public interface RuntimeServices
      * @param childNamespace
      * @return
      */
-    public Logger getLog(String childNamespace);
+    Logger getLog(String childNamespace);
 
     /**
      * Returns the event handlers for the application.
      * @return The event handlers for the application.
      */
-    public EventCartridge getApplicationEventCartridge();
+    EventCartridge getApplicationEventCartridge();
 
     /**
      * Returns true if the RuntimeInstance has been successfully initialized.
      * @return True if the RuntimeInstance has been successfully initialized.
      */
-    public boolean isInitialized();
+    boolean isInitialized();
 
     /**
      * Create a new parser instance.
      * @return A new parser instance.
      */
-    public Parser createNewParser();
+    Parser createNewParser();
 
     /**
      * Retrieve a previously instantiated directive.
@@ -454,17 +454,17 @@ public interface RuntimeServices
      * @return the directive with that name, if any
      * @since 1.6
      */
-    public Directive getDirective(String name);
+    Directive getDirective(String name);
 
     /**
      * Check whether the engine uses string interning
      * @return true if string interning is active
      */
-    public boolean useStringInterning();
+    boolean useStringInterning();
 
     /**
      * get space gobbling mode
      * @return space gobbling mode
      */
-    public SpaceGobbling getSpaceGobbling();
+    SpaceGobbling getSpaceGobbling();
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeSingleton.java Sat Jan 28 19:21:08 2017
@@ -58,7 +58,7 @@ import java.util.Properties;
  * -----------------------------------------------------------------------
  * RuntimeSingleton.init(String/Properties)
  *
- * In this case the default velocity properties are layed down
+ * In this case the default velocity properties are laid down
  * first to provide a solid base, then any properties provided
  * in the given properties object will override the corresponding
  * default property.
@@ -407,7 +407,7 @@ public class RuntimeSingleton implements
      * @param macro  root AST node of the parsed macro
      * @param macroArgs  Array of macro arguments, containing the
      *        #macro() arguments and default values.  the 0th is the name.
-     * @param definingTemplate Templaite containing the definition of the macro.
+     * @param definingTemplate Template containing the definition of the macro.
      */
     public static boolean addVelocimacro(String name, Node macro,
                                          List<Macro.MacroArg> macroArgs, Template definingTemplate)

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=1780734&r1=1780733&r2=1780734&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 Sat Jan 28 19:21:08 2017
@@ -89,7 +89,7 @@ public class VelocimacroFactory
     /**
      *  vector of the library names
      */
-    private List macroLibVec = null;
+    private List<String> macroLibVec = null;
 
     /**
      *  map of the library Template objects
@@ -164,20 +164,18 @@ public class VelocimacroFactory
 
              if(libfiles != null)
              {
-                 macroLibVec = new ArrayList();
+                 macroLibVec = new ArrayList<>();
                  if (libfiles instanceof Vector)
                  {
-                     macroLibVec.addAll((Vector)libfiles);
+                     macroLibVec.addAll((Vector<String>)libfiles);
                  }
                  else if (libfiles instanceof String)
                  {
-                     macroLibVec.add(libfiles);
+                     macroLibVec.add((String)libfiles);
                  }
 
-                 for(int i = 0, is = macroLibVec.size(); i < is; i++)
+                 for (String lib : macroLibVec)
                  {
-                     String lib = (String) macroLibVec.get(i);
-
                      /*
                       * only if it's a non-empty string do we bother
                       */

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroManager.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroManager.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroManager.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/VelocimacroManager.java Sat Jan 28 19:21:08 2017
@@ -53,7 +53,7 @@ public class VelocimacroManager
     /** reference to global namespace hash */
     private final Map globalNamespace;
 
-    /** set of names of library tempates/namespaces */
+    /** set of names of library templates/namespaces */
     private final Map libraries = new ConcurrentHashMap(17, 0.5f, 20);
 
     private RuntimeServices rsvc = null;
@@ -258,12 +258,8 @@ public class VelocimacroManager
          *  currently, we only support the local template namespace idea
          */
 
-        if (inlineLocalMode)
-        {
-            return true;
-        }
+        return inlineLocalMode;
 
-        return false;
     }
 
     /**

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/DirectiveConstants.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/DirectiveConstants.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/DirectiveConstants.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/DirectiveConstants.java Sat Jan 28 19:21:08 2017
@@ -28,8 +28,8 @@ package org.apache.velocity.runtime.dire
 public interface DirectiveConstants
 {
     /** Block directive indicator */
-    public static final int BLOCK = 1;
+    int BLOCK = 1;
 
     /** Line directive indicator */
-    public static final int LINE = 2;
+    int LINE = 2;
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Evaluate.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Evaluate.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Evaluate.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Evaluate.java Sat Jan 28 19:21:08 2017
@@ -165,17 +165,12 @@ public class Evaluate extends Directive
         {
             nodeTree = rsvc.parse(new StringReader(sourceText), template);
         }
-        catch (ParseException pex)
+        catch (ParseException | TemplateInitException pex)
         {
             // use the line/column from the template
             Info info = new Info( templateName, node.getLine(), node.getColumn() );
             throw  new ParseErrorException( pex.getMessage(), info );
         }
-        catch (TemplateInitException pex)
-        {
-            Info info = new Info( templateName, node.getLine(), node.getColumn() );
-            throw  new ParseErrorException( pex.getMessage(), info );
-        }
 
         /*
          * now we want to init and render.  Chain the context

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Include.java Sat Jan 28 19:21:08 2017
@@ -45,7 +45,7 @@ import java.io.Writer;
  * <li>For security reasons, the included source material can only come
  *    from somewhere within the template root tree.  If you want to include
  *    content from elsewhere on your disk, add extra template roots, or use
- *    a link from somwhere under template root to that content.</li>
+ *    a link from somwehere under template root to that content.</li>
  *
  *  <li>By default, there is no output to the render stream in the event of
  *    a problem.  You can override this behavior with two property values :

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Macro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Macro.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Macro.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Macro.java Sat Jan 28 19:21:08 2017
@@ -153,9 +153,9 @@ public class Macro extends Directive
         {
             if (argtypes.get(argPos) == ParserTreeConstants.JJTDIRECTIVEASSIGN)
             {
-               // Abosrb next argument type since parser enforces that these are in
+               // Absorb next argument type since parser enforces that these are in
                // pairs, and we don't need to check the type of the second
-               // arg becuase it is done by the parser.
+               // arg because it is done by the parser.
                argPos++;
                consecutive = true;
             }
@@ -176,7 +176,7 @@ public class Macro extends Directive
 
     /**
      * Creates an array containing the literal text from the macro
-     * arguement(s) (including the macro's name as the first arg).
+     * argument(s) (including the macro's name as the first arg).
      *
      * @param node The parse node from which to grok the argument
      * list.  It's expected to include the block node tree (for the
@@ -267,8 +267,8 @@ public class Macro extends Directive
      *         has passed in as buf, this method returns it.
      * @since 1.5
      */
-    public static final StringBuilder macroToString(final StringBuilder buf,
-                                                   List<MacroArg> macroArgs)
+    public static StringBuilder macroToString(final StringBuilder buf,
+                                              List<MacroArg> macroArgs)
     {
         StringBuilder ret = (buf == null) ? new StringBuilder() : buf;
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/MacroParseException.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/MacroParseException.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/MacroParseException.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/MacroParseException.java Sat Jan 28 19:21:08 2017
@@ -133,19 +133,19 @@ public class MacroParseException
 
         StringBuilder expected = new StringBuilder();
 
-        for (int i = 0; i < expectedTokenSequences.length; i++)
+        for (int[] expectedTokenSequence : expectedTokenSequences)
         {
-            if (maxSize < expectedTokenSequences[i].length)
+            if (maxSize < expectedTokenSequence.length)
             {
-                maxSize = expectedTokenSequences[i].length;
+                maxSize = expectedTokenSequence.length;
             }
 
-            for (int j = 0; j < expectedTokenSequences[i].length; j++)
+            for (int j = 0; j < expectedTokenSequence.length; j++)
             {
-                expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" ");
+                expected.append(tokenImage[expectedTokenSequence[j]]).append(" ");
             }
 
-            if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0)
+            if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0)
             {
                 expected.append("...");
             }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Parse.java Sat Jan 28 19:21:08 2017
@@ -51,7 +51,7 @@ import java.util.List;
  *  1) The parsed source material can only come from somewhere in
  *    the TemplateRoot tree for security reasons. There is no way
  *    around this.  If you want to include content from elsewhere on
- *    your disk, use a link from somwhere under Template Root to that
+ *    your disk, use a link from somewhere under Template Root to that
  *    content.
  *
  *  2) There is a limited parse depth.  It is set as a property
@@ -193,9 +193,9 @@ public class Parse extends InputBase
             if (templateStack.length >= maxDepth)
             {
                 StringBuilder path = new StringBuilder();
-                for( int i = 0; i < templateStack.length; ++i)
+                for (String aTemplateStack : templateStack)
                 {
-                    path.append( " > " + templateStack[i] );
+                    path.append(" > " + aTemplateStack);
                 }
                 log.error("Max recursion depth reached ({}) File stack: {}",
                           templateStack.length, path);

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/RuntimeMacro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/RuntimeMacro.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/RuntimeMacro.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/RuntimeMacro.java Sat Jan 28 19:21:08 2017
@@ -230,10 +230,10 @@ public class RuntimeMacro extends Direct
 
     /**
      * Velocimacro implementation is not known at the init time. So look for
-     * a implementation in the macro libaries and if finds one renders it. The
+     * a implementation in the macro libraries and if finds one renders it. The
      * actual rendering is delegated to the VelocimacroProxy object. When
      * looking for a macro we first loot at the template with has the
-     * macro call then we look at the macro lbraries in the order they appear
+     * macro call then we look at the macro libraries in the order they appear
      * in the list. If a macro has many definitions above look up will
      * determine the precedence.
      *
@@ -330,7 +330,7 @@ public class RuntimeMacro extends Direct
                 }
                 return true;
             }
-            catch (RuntimeException e)
+            catch (RuntimeException | IOException e)
             {
                 /**
                  * We catch, the exception here so that we can record in
@@ -342,12 +342,6 @@ public class RuntimeMacro extends Direct
                 log.error("Exception in macro #{} called at {}",
                           macroName, StringUtils.formatFileString(node));
                 throw e;
-            }
-            catch (IOException e)
-            {
-                log.error("Exception in macro #{} called at {}",
-                          macroName, StringUtils.formatFileString(node));
-                throw e;
             }
             finally
             {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Scope.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Scope.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Scope.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Scope.java Sat Jan 28 19:21:08 2017
@@ -280,7 +280,7 @@ public class Scope extends AbstractMap
             {
                 String vtl = getTemplate();
                 sb.append(" template:");
-                if (vtl.indexOf(" ") < 0)
+                if (!vtl.contains(" "))
                 {
                     sb.append(vtl);
                 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java Sat Jan 28 19:21:08 2017
@@ -284,7 +284,7 @@ public class VelocimacroProxy extends Di
                 }
                 out.append(stack[i]);
             }
-            out.append(" at " + StringUtils.formatFileString(this));
+            out.append(" at ").append(StringUtils.formatFileString(this));
             log.error(out.toString());
 
             // clean out the macro stack, since we just broke it

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/ParseException.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/ParseException.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/ParseException.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/ParseException.java Sat Jan 28 19:21:08 2017
@@ -123,14 +123,18 @@ public class ParseException extends Exce
         }
         String expected = "";
         int maxSize = 0;
-        for (int i = 0; i < expectedTokenSequences.length; i++) {
-            if (maxSize < expectedTokenSequences[i].length) {
-                maxSize = expectedTokenSequences[i].length;
+        for (int[] expectedTokenSequence : expectedTokenSequences)
+        {
+            if (maxSize < expectedTokenSequence.length)
+            {
+                maxSize = expectedTokenSequence.length;
             }
-            for (int j = 0; j < expectedTokenSequences[i].length; j++) {
-                expected += tokenImage[expectedTokenSequences[i][j]] + " ";
+            for (int j = 0; j < expectedTokenSequence.length; j++)
+            {
+                expected += tokenImage[expectedTokenSequence[j]] + " ";
             }
-            if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0) {
+            if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0)
+            {
                 expected += "...";
             }
             expected += eol + "    ";
@@ -202,11 +206,10 @@ public class ParseException extends Exce
                 default:
                     if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
                         String s = "0000" + Integer.toString(ch, 16);
-                        retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+                        retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
                     } else {
                         retval.append(ch);
                     }
-                    continue;
             }
         }
         return retval.toString();

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/TemplateParseException.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/TemplateParseException.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/TemplateParseException.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/TemplateParseException.java Sat Jan 28 19:21:08 2017
@@ -107,8 +107,8 @@ public class TemplateParseException
     }
 
     /**
-     * returns the Template name where this exception occured.
-     * @return The Template name where this exception occured.
+     * returns the Template name where this exception occurred.
+     * @return The Template name where this exception occurred.
      */
     public String getTemplateName()
     {
@@ -116,8 +116,8 @@ public class TemplateParseException
     }
 
     /**
-     * returns the line number where this exception occured.
-     * @return The line number where this exception occured.
+     * returns the line number where this exception occurred.
+     * @return The line number where this exception occurred.
      */
     public int getLineNumber()
     {
@@ -132,8 +132,8 @@ public class TemplateParseException
     }
 
     /**
-     * returns the column number where this exception occured.
-     * @return The column number where this exception occured.
+     * returns the column number where this exception occurred.
+     * @return The column number where this exception occurred.
      */
     public int getColumnNumber()
     {
@@ -171,19 +171,19 @@ public class TemplateParseException
 
         StringBuilder expected = new StringBuilder();
 
-        for (int i = 0; i < expectedTokenSequences.length; i++)
+        for (int[] expectedTokenSequence : expectedTokenSequences)
         {
-            if (maxSize < expectedTokenSequences[i].length)
+            if (maxSize < expectedTokenSequence.length)
             {
-                maxSize = expectedTokenSequences[i].length;
+                maxSize = expectedTokenSequence.length;
             }
 
-            for (int j = 0; j < expectedTokenSequences[i].length; j++)
+            for (int j = 0; j < expectedTokenSequence.length; j++)
             {
-                expected.append(tokenImage[expectedTokenSequences[i][j]]).append(" ");
+                expected.append(tokenImage[expectedTokenSequence[j]]).append(" ");
             }
 
-            if (expectedTokenSequences[i][expectedTokenSequences[i].length - 1] != 0)
+            if (expectedTokenSequence[expectedTokenSequence.length - 1] != 0)
             {
                 expected.append("...");
             }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/VelocityCharStream.java Sat Jan 28 19:21:08 2017
@@ -60,7 +60,7 @@ implements CharStream
     private int maxNextCharInd = 0;
     private int inBuf = 0;
 
-    private final void ExpandBuff(boolean wrapAround)
+    private void ExpandBuff(boolean wrapAround)
     {
         char[] newbuffer = new char[bufsize + nextBufExpand];
         int newbufline[] = new int[bufsize + nextBufExpand];
@@ -111,7 +111,7 @@ implements CharStream
         tokenBegin = 0;
     }
 
-    private final void FillBuff() throws java.io.IOException
+    private void FillBuff() throws java.io.IOException
     {
         if (maxNextCharInd == available)
         {
@@ -158,7 +158,6 @@ implements CharStream
             {
                 maxNextCharInd += i;
             }
-            return;
         }
         catch(java.io.IOException e)
         {
@@ -184,7 +183,7 @@ implements CharStream
         return c;
     }
 
-    private final void UpdateLineColumn(char c)
+    private void UpdateLineColumn(char c)
     {
         column++;
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComparisonNode.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComparisonNode.java?rev=1780734&r1=1780733&r2=1780734&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComparisonNode.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComparisonNode.java Sat Jan 28 19:21:08 2017
@@ -159,6 +159,6 @@ public abstract class ASTComparisonNode
      */
     public Object value(InternalContextAdapter context) throws MethodInvocationException
     {
-        return Boolean.valueOf(evaluate(context));
+        return evaluate(context);
     }
 }



Mime
View raw message