You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by cb...@apache.org on 2016/07/17 23:33:11 UTC

svn commit: r1753137 [2/4] - in /velocity/engine/trunk/velocity-engine-core/src: main/java/org/apache/velocity/ main/java/org/apache/velocity/app/ main/java/org/apache/velocity/app/event/ main/java/org/apache/velocity/app/event/implement/ main/java/org...

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,18 +19,15 @@ package org.apache.velocity.runtime;
  * under the License.    
  */
 
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
+import org.apache.velocity.Template;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.directive.Macro;
 import org.apache.velocity.runtime.directive.VelocimacroProxy;
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.runtime.parser.node.SimpleNode;
+
+import java.util.List;
+import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
 /**
@@ -51,18 +48,13 @@ import java.util.concurrent.ConcurrentHa
  */
 public class VelocimacroManager
 {
-    private static String GLOBAL_NAMESPACE = "";
-
     private boolean registerFromLib = false;
 
-    /** Hash of namespace hashes. */
-    private final Map namespaceHash = new ConcurrentHashMap(17, 0.5f, 20);
-
     /** reference to global namespace hash */
     private final Map globalNamespace;
 
     /** set of names of library tempates/namespaces */
-    private final Set libraries = Collections.synchronizedSet(new HashSet());
+    private final Map libraries = new ConcurrentHashMap(17, 0.5f, 20);
     
     private RuntimeServices rsvc = null;
 
@@ -83,31 +75,11 @@ public class VelocimacroManager
          *  add the global namespace to the namespace hash. We always have that.
          */
 
-        globalNamespace = addNamespace(GLOBAL_NAMESPACE);
+        globalNamespace = new ConcurrentHashMap(101, 0.5f, 20);
         this.rsvc = rsvc;
     }
 
     /**
-     * Return a list of VelocimacroProxies that are defined by the given
-     * template name.
-     */
-    public List<VelocimacroProxy> getVelocimacros(String templateName)
-    {
-      Map local = getNamespace(templateName, false);
-      ArrayList<VelocimacroProxy> macros = new ArrayList<VelocimacroProxy>(16);
-      if (local != null)
-      {
-        for (Object mo : local.values())
-        {
-          MacroEntry me = (MacroEntry)mo;
-          macros.add(me.vp);          
-        }
-      }
-      
-      return macros;      
-    }
-    
-    /**
      * Adds a VM definition to the cache.
      * 
      * Called by VelocimacroFactory.addVelociMacro (after parsing and discovery in Macro directive)
@@ -116,20 +88,21 @@ public class VelocimacroManager
      * @param macroBody String representation of the macro body.
      * @param macroArgs  Array of macro arguments, containing the
      *        #macro() arguments and default values.  the 0th is the name.
-     * @param namespace The namespace/template from which this macro has been loaded.
+     * @param definingTemplate The template from which this macro has been loaded.
+     * @param canReplaceGlobalMacro whether this macro can replace a global macro
      * @return Whether everything went okay.
      */
     public boolean addVM(final String vmName, final Node macroBody, List<Macro.MacroArg> macroArgs,
-                         final String namespace, boolean canReplaceGlobalMacro)
+                         final Template definingTemplate, boolean canReplaceGlobalMacro)
     {
         if (macroBody == null)
         {
             // happens only if someone uses this class without the Macro directive
             // and provides a null value as an argument
-            throw new VelocityException("Null AST for "+vmName+" in "+namespace);
+            throw new VelocityException("Null AST for "+vmName+" in " + definingTemplate.getName());
         }
 
-        MacroEntry me = new MacroEntry(vmName, macroBody, macroArgs, namespace, rsvc);
+        MacroEntry me = new MacroEntry(vmName, macroBody, macroArgs, definingTemplate.getName(), rsvc);
 
         me.setFromLibrary(registerFromLib);
         
@@ -146,7 +119,7 @@ public class VelocimacroManager
         
         if (registerFromLib)
         {
-           libraries.add(namespace);
+           libraries.put(definingTemplate.getName(), definingTemplate);
         }
         else
         {
@@ -158,19 +131,12 @@ public class VelocimacroManager
              *  global
              */
 
-            isLib = libraries.contains(namespace);
+            isLib = libraries.containsKey(definingTemplate.getName());
         }
 
-        if ( !isLib && usingNamespaces(namespace) )
+        if ( !isLib && usingNamespaces() )
         {
-            /*
-             *  first, do we have a namespace hash already for this namespace?
-             *  if not, add it to the namespaces, and add the VM
-             */
-
-            Map local = getNamespace(namespace, true);
-            local.put(vmName, me);
-            
+            definingTemplate.getMacros().put(vmName, me);
             return true;
         }
         else
@@ -195,30 +161,17 @@ public class VelocimacroManager
             return true;
         }
     }
-    
+
     /**
      * Gets a VelocimacroProxy object by the name / source template duple.
-     * 
+     *
      * @param vmName Name of the VelocityMacro to look up.
-     * @param namespace Namespace in which to look up the macro.
+     * @param renderingTemplate Template we are currently rendering.
+     * @param template Source Template.
      * @return A proxy representing the Macro.
      */
-     public VelocimacroProxy get(final String vmName, final String namespace)
-     {
-        return(get(vmName, namespace, null));
-     }
-
-     /**
-      * Gets a VelocimacroProxy object by the name / source template duple.
-      * 
-      * @param vmName Name of the VelocityMacro to look up.
-      * @param namespace Namespace in which to look up the macro.
-      * @param renderingTemplate Name of the template we are currently rendering.
-      * @return A proxy representing the Macro.
-      * @since 1.6
-      */
-     public VelocimacroProxy get(final String vmName, final String namespace, final String renderingTemplate)
-     {
+    public VelocimacroProxy get(final String vmName, final Template renderingTemplate, final Template template)
+    {
         if( inlineReplacesGlobal && renderingTemplate != null )
         {
             /*
@@ -227,83 +180,34 @@ public class VelocimacroManager
              * moment, check if local namespace contains a macro we are looking for
              * if so, return it instead of the global one
              */
-            Map local = getNamespace(renderingTemplate, false);
-            if (local != null)
-            {
-                MacroEntry me = (MacroEntry) local.get(vmName);
 
-                if (me != null)
-                {
-                    return me.getProxy(namespace);
-                }
+            MacroEntry me = (MacroEntry)renderingTemplate.getMacros().get(vmName);
+            if( me != null )
+            {
+                return me.getProxy();
             }
         }
-        
-        if (usingNamespaces(namespace))
-        {
-            Map local = getNamespace(namespace, false);
 
-            /*
-             *  if we have macros defined for this template
-             */
-
-            if (local != null)
+        if( usingNamespaces() && template != null )
+        {
+            MacroEntry me = (MacroEntry)template.getMacros().get(vmName);
+            if( template.getMacros().size() > 0 && me != null )
             {
-                MacroEntry me = (MacroEntry) local.get(vmName);
-                
-                if (me != null)
-                {
-                    return me.getProxy(namespace);
-                }
+                return me.getProxy();
             }
         }
 
-        /*
-         * if we didn't return from there, we need to simply see
-         * if it's in the global namespace
-         */
-
         MacroEntry me = (MacroEntry) globalNamespace.get(vmName);
 
         if (me != null)
         {
-            return me.getProxy(namespace);
+            return me.getProxy();
         }
 
         return null;
     }
 
     /**
-     * Removes the VMs and the namespace from the manager.
-     * Used when a template is reloaded to avoid
-     * losing memory.
-     *
-     * @param namespace namespace to dump
-     * @return boolean representing success
-     */
-    public boolean dumpNamespace(final String namespace)
-    {
-        synchronized(this)
-        {
-            if (usingNamespaces(namespace))
-            {
-                Map h = (Map) namespaceHash.remove(namespace);
-
-                if (h == null)
-                {
-                    return false;
-                }
-
-                h.clear();
-
-                return true;
-            }
-
-            return false;
-        }
-    }
-
-    /**
      *  public switch to let external user of manager to control namespace
      *  usage indep of properties.  That way, for example, at startup the
      *  library files are loaded into global namespace
@@ -335,63 +239,11 @@ public class VelocimacroManager
     }
 
     /**
-     *  returns the hash for the specified namespace, and if it doesn't exist
-     *  will create a new one and add it to the namespaces
-     *
-     *  @param namespace  name of the namespace :)
-     *  @param addIfNew  flag to add a new namespace if it doesn't exist
-     *  @return namespace Map of VMs or null if doesn't exist
-     */
-    private Map getNamespace(final String namespace, final boolean addIfNew)
-    {
-        Map h = (Map) namespaceHash.get(namespace);
-
-        if (h == null && addIfNew)
-        {
-            h = addNamespace(namespace);
-        }
-
-        return h;
-    }
-
-    /**
-     *   adds a namespace to the namespaces
-     *
-     *  @param namespace name of namespace to add
-     *  @return Hash added to namespaces, ready for use
-     */
-    private Map addNamespace(final String namespace)
-    {
-        Map h = new ConcurrentHashMap(17, 0.5f, 20);
-        Object oh;
-
-        if ((oh = namespaceHash.put(namespace, h)) != null)
-        {
-          /*
-           * There was already an entry on the table, restore it!
-           * This condition should never occur, given the code
-           * and the fact that this method is private.
-           * But just in case, this way of testing for it is much
-           * more efficient than testing before hand using get().
-           */
-          namespaceHash.put(namespace, oh);
-          /*
-           * Should't we be returning the old entry (oh)?
-           * The previous code was just returning null in this case.
-           */
-          return null;
-        }
-
-        return h;
-    }
-
-    /**
      *  determines if currently using namespaces.
      *
-     *  @param namespace currently ignored
      *  @return true if using namespaces, false if not
      */
-    private boolean usingNamespaces(final String namespace)
+    private boolean usingNamespaces()
     {
         /*
          *  if the big switch turns of namespaces, then ignore the rules
@@ -417,37 +269,23 @@ public class VelocimacroManager
     /**
      * Return the library name for a given macro.
      * @param vmName Name of the Macro to look up.
-     * @param namespace Namespace to look the macro up.
+     * @param template Template
      * @return The name of the library which registered this macro in a namespace.
      */
-    public String getLibraryName(final String vmName, final String namespace)
+    public String getLibraryName(final String vmName, Template template)
     {
-        if (usingNamespaces(namespace))
+        if (usingNamespaces())
         {
-            Map local = getNamespace(namespace, false);
-
             /*
              *  if we have this macro defined in this namespace, then
              *  it is masking the global, library-based one, so
              *  just return null
              */
-
-            if ( local != null)
-            {
-                MacroEntry me = (MacroEntry) local.get(vmName);
-
-                if (me != null)
-                {
-                    return null;
-                }
-            }
+            MacroEntry me = (MacroEntry)template.getMacros().get(vmName);
+            if( me != null )
+                return null;
         }
 
-        /*
-         * if we didn't return from there, we need to simply see
-         * if it's in the global namespace
-         */
-
         MacroEntry me = (MacroEntry) globalNamespace.get(vmName);
 
         if (me != null)
@@ -492,7 +330,7 @@ public class VelocimacroManager
             vp.setName(this.vmName);
             vp.setMacroArgs(this.macroArgs);
             vp.setNodeTree(this.nodeTree);
-            vp.setLocation(macro.getLine(), macro.getColumn(), macro.getTemplateName());
+            vp.setLocation(macro.getLine(), macro.getColumn(), macro.getTemplate());
             vp.init(rsvc);
         }
         
@@ -514,30 +352,13 @@ public class VelocimacroManager
             return fromLibrary;
         }
 
-        /**
-         * Returns the node tree for this macro.
-         * @return The node tree for this macro.
-         */
-        public SimpleNode getNodeTree()
-        {
-            return nodeTree;
-        }
-
-        /**
-         * Returns the source template name for this macro.
-         * @return The source template name for this macro.
-         */
         public String getSourceTemplate()
         {
             return sourceTemplate;
         }
 
-        VelocimacroProxy getProxy(final String namespace)
+        VelocimacroProxy getProxy()
         {
-            /*
-             * FIXME: namespace data is omitted, this probably 
-             * breaks some error reporting?
-             */ 
             return vp;
         }
     }

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,18 +19,17 @@ package org.apache.velocity.runtime.dire
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.StringWriter;
-import java.io.Writer;
-
-import org.slf4j.Logger;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.Renderable;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.util.StringUtils;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.io.StringWriter;
+import java.io.Writer;
 
 /**
  * Directive that puts an unrendered AST block in the context

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/BlockMacro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/BlockMacro.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/BlockMacro.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/BlockMacro.java Sun Jul 17 23:33:09 2016
@@ -19,15 +19,15 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.RuntimeConstants;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.parser.node.Node;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * BlockMacro directive is used to invoke Velocity macros with normal parameters and a macro body.
  * <p>
@@ -102,7 +102,7 @@ public class BlockMacro extends Block
         maxDepth = rs.getInt(RuntimeConstants.VM_MAX_DEPTH);
 
         macro = new RuntimeMacro(name);
-        macro.setLocation(getLine(), getColumn(), getTemplateName());
+        macro.setLocation(getLine(), getColumn(), getTemplate());
         macro.init(rs, context, node);
     }
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Break.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Break.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Break.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Break.java Sun Jul 17 23:33:09 2016
@@ -19,8 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.Writer;
-import java.util.ArrayList;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.runtime.RuntimeServices;
@@ -29,6 +27,9 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.Writer;
+import java.util.ArrayList;
+
 /**
  * Break directive used for interrupting scopes.
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Define.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Define.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Define.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Define.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.Writer;
-import java.util.ArrayList;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.exception.VelocityException;
@@ -33,6 +30,9 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.Writer;
+import java.util.ArrayList;
+
 /**
  * Directive that puts an unrendered AST block in the context
  * under the specified key, postponing rendering until the

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Directive.java Sun Jul 17 23:33:09 2016
@@ -19,10 +19,7 @@ package org.apache.velocity.runtime.dire
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-
+import org.apache.velocity.Template;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -34,6 +31,10 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.Token;
 import org.apache.velocity.runtime.parser.node.Node;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+
 
 /**
  * Base class for all directives used in Velocity.
@@ -47,7 +48,7 @@ public abstract class Directive implemen
     private int line = 0;
     private int column = 0;
     private boolean provideScope = false;
-    private String templateName;
+    private Template template;
 
     /**
      *
@@ -82,10 +83,19 @@ public abstract class Directive implemen
      * @param line
      * @param column
      */
-    public void setLocation(int line, int column, String templateName)
+    public void setLocation(int line, int column, Template template)
     {
         setLocation(line, column);
-        this.templateName = templateName;
+        this.template = template;
+    }
+
+    /**
+     * returns the template in which this directive appears
+     * @return template
+     */
+    public Template getTemplate()
+    {
+        return template;
     }
 
     /**
@@ -112,7 +122,7 @@ public abstract class Directive implemen
      */
     public String getTemplateName()
     {
-      return templateName;
+      return template.getName();
     }
 
     /**

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,9 +19,7 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.Writer;
+import org.apache.velocity.Template;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -34,6 +32,10 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.SimpleNode;
 import org.apache.velocity.util.introspection.Info;
 
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.Writer;
+
 /**
  * Evaluates the directive argument as a VTL string, using the existing
  * context.
@@ -151,11 +153,17 @@ public class Evaluate extends Directive
          * The new string needs to be parsed since the text has been dynamically generated.
          */
         String templateName = context.getCurrentTemplateName();
+        Template template = (Template)context.getCurrentResource();
+        if (template == null)
+        {
+            template = new Template();
+            template.setName(templateName);
+        }
         SimpleNode nodeTree = null;
 
         try
         {
-            nodeTree = rsvc.parse(new StringReader(sourceText), templateName, false);
+            nodeTree = rsvc.parse(new StringReader(sourceText), template);
         }
         catch (ParseException pex)
         {

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Foreach.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.Closeable;
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.exception.VelocityException;
@@ -39,6 +33,12 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.util.StringUtils;
 import org.apache.velocity.util.introspection.Info;
 
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Iterator;
+
 /**
  * Foreach directive used for moving through arrays,
  * or objects that provide an Iterator.

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,9 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.app.event.EventHandlerUtil;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
@@ -35,6 +32,9 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.resource.Resource;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * <p>Pluggable directive that handles the #include() statement in VTL.
  * This #include() can take multiple arguments of either

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,11 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.RuntimeServices;
@@ -32,6 +27,11 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.Token;
 import org.apache.velocity.runtime.parser.node.Node;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  *  Macro implements the macro definition directive of VTL.
  *
@@ -115,7 +115,7 @@ public class Macro extends Directive
         List<MacroArg> macroArgs = getArgArray(node, rs);
         int numArgs = node.jjtGetNumChildren();
         rs.addVelocimacro(macroArgs.get(0).name, node.jjtGetChild(numArgs - 1), 
-            macroArgs, node.getTemplateName());
+            macroArgs, node.getTemplate());
     }
     
     /**

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,11 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.velocity.Template;
 import org.apache.velocity.app.event.EventHandlerUtil;
 import org.apache.velocity.context.InternalContextAdapter;
@@ -41,6 +36,11 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.SimpleNode;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * Pluggable directive that handles the <code>#parse()</code>
  * statement in VTL.
@@ -266,7 +266,8 @@ public class Parse extends InputBase
 
         context.setMacroLibraries(macroLibraries);
 
-        macroLibraries.add(arg);
+        /* instead of adding the name of the template, add the Template reference */
+        macroLibraries.add(t);
 
         /*
          *  and render it

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,10 +19,7 @@ package org.apache.velocity.runtime.dire
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.List;
-
+import org.apache.velocity.Template;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -37,6 +34,10 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.Node;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
 /**
  * This class acts as a proxy for potential macros.  When the AST is built
  * this class is inserted as a placeholder for the macro (whether or not
@@ -247,12 +248,12 @@ public class RuntimeMacro extends Direct
             ParseErrorException, MethodInvocationException
     {
         VelocimacroProxy vmProxy = null;
-        String renderingTemplate = context.getCurrentTemplateName();
+        Template renderingTemplate = (Template)context.getCurrentResource();
 
         /**
          * first look in the source template
          */
-        Object o = rsvc.getVelocimacro(macroName, getTemplateName(), renderingTemplate);
+        Object o = rsvc.getVelocimacro(macroName, renderingTemplate, getTemplate());
 
         if( o != null )
         {
@@ -271,8 +272,7 @@ public class RuntimeMacro extends Direct
             {
                 for (int i = macroLibraries.size() - 1; i >= 0; i--)
                 {
-                    o = rsvc.getVelocimacro(macroName,
-                            (String)macroLibraries.get(i), renderingTemplate);
+                    o = rsvc.getVelocimacro(macroName, renderingTemplate, (Template)macroLibraries.get(i));
 
                     // get the first matching macro
                     if (o != null)

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,11 +19,12 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
+import org.apache.velocity.Template;
+
 import java.util.AbstractMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
-import org.apache.velocity.Template;
 
 /**
  * This handles context scoping and metadata for directives.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/Stop.java Sun Jul 17 23:33:09 2016
@@ -19,15 +19,15 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.Writer;
-import java.util.ArrayList;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.parser.ParseException;
-import org.apache.velocity.runtime.parser.ParserTreeConstants;
 import org.apache.velocity.runtime.parser.Token;
 import org.apache.velocity.runtime.parser.node.Node;
 
+import java.io.Writer;
+import java.util.ArrayList;
+
 /**
  * This class implements the #stop directive which allows
  * a user to stop the merging and rendering process. The #stop directive

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,10 +19,6 @@ package org.apache.velocity.runtime.dire
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.List;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MacroOverflowException;
 import org.apache.velocity.exception.VelocityException;
@@ -34,6 +30,10 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.SimpleNode;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.List;
+
 /**
  *  VelocimacroProxy.java
  *
@@ -274,7 +274,6 @@ public class VelocimacroProxy extends Di
     {
         if (maxCallDepth > 0 && maxCallDepth == context.getCurrentMacroCallDepth())
         {
-            String templateName = context.getCurrentTemplateName();
             String[] stack = context.getMacroNameStack();
 
             StringBuffer out = new StringBuffer(100)

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/contrib/For.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/contrib/For.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/contrib/For.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/directive/contrib/For.java Sun Jul 17 23:33:09 2016
@@ -18,10 +18,6 @@
  */
 package org.apache.velocity.runtime.directive.contrib;
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.ArrayList;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.RuntimeServices;
@@ -33,6 +29,10 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.node.ASTReference;
 import org.apache.velocity.runtime.parser.node.Node;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.util.ArrayList;
+
 /**
  * The #for directive provides the behavior of the #foreach directive but also
  * provides an 'index' keyword that allows the user to define an optional index variable

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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -20,7 +20,6 @@ package org.apache.velocity.runtime.pars
  */
 
 import org.apache.velocity.exception.ExtendedParseException;
-
 import org.apache.velocity.util.StringUtils;
 
 /**

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTAndNode.java Sun Jul 17 23:33:09 2016
@@ -69,8 +69,6 @@ public class ASTAndNode extends SimpleNo
     public Object value(InternalContextAdapter context)
         throws MethodInvocationException
     {
-        // TODO: JDK 1.4+ -> valueOf()
-        // return new Boolean(evaluate(context));
         return evaluate(context) ? Boolean.TRUE : Boolean.FALSE;
     }
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTBlock.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTBlock.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTBlock.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTBlock.java Sun Jul 17 23:33:09 2016
@@ -19,15 +19,15 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.io.IOException;
+import java.io.Writer;
+
 
 /**
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComment.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComment.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComment.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTComment.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,6 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -29,6 +26,9 @@ import org.apache.velocity.exception.Res
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.runtime.parser.Token;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  *  Represents all comments...
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTDirective.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTDirective.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTDirective.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTDirective.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,6 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -34,6 +31,9 @@ import org.apache.velocity.runtime.direc
 import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * This class is responsible for handling the pluggable
  * directives in VTL.
@@ -121,7 +121,7 @@ public class ASTDirective extends Simple
                             e);
                 }
 
-                directive.setLocation(getLine(), getColumn(), getTemplateName());
+                directive.setLocation(getLine(), getColumn(), getTemplate());
                 directive.init(rsvc, context,this);
             }
             else if( directiveName.startsWith("@") )
@@ -132,7 +132,7 @@ public class ASTDirective extends Simple
                     directiveName = directiveName.substring(1);
 
                     directive = new BlockMacro(directiveName);
-                    directive.setLocation(getLine(), getColumn(), getTemplateName());
+                    directive.setLocation(getLine(), getColumn(), getTemplate());
 
                     try
                     {
@@ -161,7 +161,7 @@ public class ASTDirective extends Simple
                  * Create a new RuntimeMacro
                  */
                 directive = new RuntimeMacro(directiveName);
-                directive.setLocation(getLine(), getColumn(), getTemplateName());
+                directive.setLocation(getLine(), getColumn(), getTemplate());
 
                 /**
                  * Initialize it

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTElseIfStatement.java Sun Jul 17 23:33:09 2016
@@ -19,15 +19,15 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * This class is responsible for handling the ElseIf VTL control statement.
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscape.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscape.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscape.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscape.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * This class is responsible for handling Escapes
  *  in VTL.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTEscapedDirective.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * This class is responsible for handling EscapedDirectives
  *  in VTL.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTFloatingPointLiteral.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.math.BigDecimal;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.math.BigDecimal;
+
 
 /**
  * Handles floating point numbers.  The value will be either a Double

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIdentifier.java Sun Jul 17 23:33:09 2016
@@ -19,8 +19,6 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.lang.reflect.InvocationTargetException;
-
 import org.apache.velocity.app.event.EventHandlerUtil;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
@@ -32,6 +30,8 @@ import org.apache.velocity.util.introspe
 import org.apache.velocity.util.introspection.IntrospectionCacheData;
 import org.apache.velocity.util.introspection.VelPropertyGet;
 
+import java.lang.reflect.InvocationTargetException;
+
 /**
  *  ASTIdentifier.java
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIfStatement.java Sun Jul 17 23:33:09 2016
@@ -29,15 +29,15 @@ package org.apache.velocity.runtime.pars
 */
 
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.io.IOException;
+import java.io.Writer;
+
 
 /**
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerLiteral.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.math.BigInteger;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.math.BigInteger;
+
 /**
  * Handles integer numbers.  The value will be either an Integer, a Long, or a BigInteger.
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTIntegerRange.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,14 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.util.StringUtils;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  * handles the range 'operator'  [ n .. m ]
  *
@@ -136,7 +136,6 @@ public class ASTIntegerRange extends Sim
 
         for (int i = 0; i < nbrElements; i++)
         {
-            // TODO: JDK 1.4+ -> valueOf()
             elements.add(new Integer(value));
             value += delta;
         }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMap.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMap.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMap.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMap.java Sun Jul 17 23:33:09 2016
@@ -19,13 +19,13 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.util.LinkedHashMap;
-import java.util.Map;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.util.LinkedHashMap;
+import java.util.Map;
+
 /**
  * AST Node for creating a map / dictionary.
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTMethod.java Sun Jul 17 23:33:09 2016
@@ -19,8 +19,6 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.lang.reflect.InvocationTargetException;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.app.event.EventHandlerUtil;
 import org.apache.velocity.context.InternalContextAdapter;
@@ -35,6 +33,8 @@ import org.apache.velocity.util.introspe
 import org.apache.velocity.util.introspection.IntrospectionCacheData;
 import org.apache.velocity.util.introspection.VelMethod;
 
+import java.lang.reflect.InvocationTargetException;
+
 /**
  *  ASTMethod.java
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTObjectArray.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTObjectArray.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTObjectArray.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTObjectArray.java Sun Jul 17 23:33:09 2016
@@ -19,13 +19,13 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.runtime.parser.Parser;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
  *
  */

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTOrNode.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTOrNode.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTOrNode.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTOrNode.java Sun Jul 17 23:33:09 2016
@@ -69,8 +69,6 @@ public class ASTOrNode extends SimpleNod
     public Object value(InternalContextAdapter context )
         throws MethodInvocationException
     {
-        // TODO: JDK 1.4+ -> valueOf()
-        // return new Boolean(evaluate(context));
         return evaluate(context) ? Boolean.TRUE : Boolean.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=1753137&r1=1753136&r2=1753137&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 Sun Jul 17 23:33:09 2016
@@ -19,12 +19,7 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.lang.reflect.InvocationTargetException;
-
 import org.apache.velocity.app.event.EventHandlerUtil;
-import org.apache.velocity.context.Context;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.TemplateInitException;
@@ -42,6 +37,10 @@ import org.apache.velocity.util.introspe
 import org.apache.velocity.util.introspection.VelMethod;
 import org.apache.velocity.util.introspection.VelPropertySet;
 
+import java.io.IOException;
+import java.io.Writer;
+import java.lang.reflect.InvocationTargetException;
+
 /**
  * This class is responsible for handling the references in
  * VTL ($foo).

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTSetDirective.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,6 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.app.event.EventHandlerUtil;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
@@ -30,6 +27,9 @@ import org.apache.velocity.runtime.Runti
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.util.introspection.Info;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * Node for the #set directive
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTStringLiteral.java Sun Jul 17 23:33:09 2016
@@ -17,10 +17,7 @@ package org.apache.velocity.runtime.pars
  * the License.
  */
 
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-
+import org.apache.velocity.Template;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.exception.VelocityException;
@@ -30,6 +27,10 @@ import org.apache.velocity.runtime.parse
 import org.apache.velocity.runtime.parser.Token;
 import org.apache.velocity.util.StringUtils;
 
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
 /**
  * ASTStringLiteral support. Will interpolate!
  *
@@ -163,17 +164,25 @@ public class ASTStringLiteral extends Si
              * Also, do *not* dump the VM namespace for this template
              */
 
-            String templateName =
-                (context != null) ? context.getCurrentTemplateName() : "StringLiteral";
+            Template template = null;
+            if (context != null)
+            {
+                template = (Template)context.getCurrentResource();
+            }
+            if (template == null)
+            {
+                template = new Template();
+                template.setName("StringLiteral");
+            }
             try
             {
-                nodeTree = rsvc.parse(br, templateName, false);
+                nodeTree = rsvc.parse(br, template);
             }
             catch (ParseException e)
             {
                 String msg = "Failed to parse String literal at "+
-                    StringUtils.formatFileString(templateName, getLine(), getColumn());
-                throw new TemplateInitException(msg, e, templateName, getColumn(), getLine());
+                    StringUtils.formatFileString(template.getName(), getLine(), getColumn());
+                throw new TemplateInitException(msg, e, template.getName(), getColumn(), getLine());
             }
 
             adjTokenLineNums(nodeTree);
@@ -233,7 +242,6 @@ public class ASTStringLiteral extends Si
         }
 
         StringBuilder result = new StringBuilder(s.length());
-        char prev = ' ';
         for(int i = 0, is = s.length(); i < is; i++)
         {
             char c = s.charAt(i);

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTText.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,14 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.runtime.parser.Token;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  *
  */

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTTextblock.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTTextblock.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTTextblock.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ASTTextblock.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,14 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.TemplateInitException;
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.runtime.parser.Token;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  * This node holds the "Textblock" data which should not be interpreted by Velocity.
  *

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/AbstractExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,11 +19,11 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
+import org.slf4j.Logger;
+
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import org.slf4j.Logger;
-
 /**
  * Abstract class that is used to execute an arbitrary
  * method that is in introspected. This is the superclass

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/BooleanPropertyExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/BooleanPropertyExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/BooleanPropertyExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/BooleanPropertyExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,10 +19,9 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import org.slf4j.Logger;
-
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
 
 /**
  *  Handles discovery and valuation of a

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/GetExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/GetExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/GetExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/GetExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,11 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.lang.reflect.InvocationTargetException;
-
-import org.slf4j.Logger;
-
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
+
+import java.lang.reflect.InvocationTargetException;
 
 
 /**

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapGetExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapGetExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapGetExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapGetExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,11 +19,10 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.util.Map;
-
+import org.apache.velocity.exception.VelocityException;
 import org.slf4j.Logger;
 
-import org.apache.velocity.exception.VelocityException;
+import java.util.Map;
 
 /**
  * GetExecutor that is smart about Maps. If it detects one, it does not

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapSetExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapSetExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapSetExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MapSetExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,11 +19,10 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.util.Map;
-
+import org.apache.velocity.exception.VelocityException;
 import org.slf4j.Logger;
 
-import org.apache.velocity.exception.VelocityException;
+import java.util.Map;
 
 /**
  * SetExecutor that is smart about Maps. If it detects one, it does not

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/MathUtils.java Sun Jul 17 23:33:09 2016
@@ -21,10 +21,10 @@ package org.apache.velocity.runtime.pars
 
 import java.math.BigDecimal;
 import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Map;
 import java.util.List;
-import java.util.ArrayList;
+import java.util.Map;
 
 /**
  * Utility-class for all arithmetic-operations.<br><br>
@@ -184,8 +184,7 @@ public abstract class MathUtils
             }
             else
             {
-                // TODO: JDK 1.4+ -> valueOf()
-                return new Byte ((byte)value);
+                return Byte.valueOf((byte)value);
             }
         }
         if (type == Short.class)
@@ -196,8 +195,7 @@ public abstract class MathUtils
             }
             else
             {
-                // TODO: JDK 1.4+ -> valueOf()
-                return new Short((short)value);
+                return Short.valueOf((short)value);
             }
         }
         if (type == Integer.class)
@@ -208,14 +206,12 @@ public abstract class MathUtils
             }
             else
             {
-                // TODO: JDK 1.4+ -> valueOf()
-                return new Integer ((int)value);
+                return Integer.valueOf((int)value);
             }
         }
         if (type == Long.class)
         {
-            // TODO: JDK 1.4+ -> valueOf()
-            return new Long (value);
+            return Long.valueOf(value);
         }
         return BigInteger.valueOf( value);
     }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/Node.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/Node.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/Node.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/Node.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,7 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.Writer;
-
+import org.apache.velocity.Template;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -30,6 +28,9 @@ import org.apache.velocity.exception.Tem
 import org.apache.velocity.runtime.Renderable;
 import org.apache.velocity.runtime.parser.Token;
 
+import java.io.IOException;
+import java.io.Writer;
+
 /**
  *  This file describes the interface between the Velocity code
  *  and the JavaCC generated code.
@@ -205,4 +206,10 @@ public interface Node extends Renderable
      * @return the file name of the template
      */
     public String getTemplateName();
+
+    /**
+     * @return the template this node belongs to
+     */
+    public Template getTemplate();
+
 }

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/ParserVisitor.java Sun Jul 17 23:33:09 2016
@@ -1,7 +1,5 @@
 package org.apache.velocity.runtime.parser.node;
 
-import org.apache.velocity.runtime.directive.Stop;
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one
  * or more contributor license agreements.  See the NOTICE file

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PropertyExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,13 +19,12 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.lang.reflect.InvocationTargetException;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
+
+import java.lang.reflect.InvocationTargetException;
 
 /**
  * Returned the value of object property when executed.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PublicFieldExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PublicFieldExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PublicFieldExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PublicFieldExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,13 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
 
 /**
  * Returns the value of a public field when executed.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PutExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PutExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PutExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/PutExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,11 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
-import java.lang.reflect.InvocationTargetException;
-
-import org.slf4j.Logger;
-
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
+
+import java.lang.reflect.InvocationTargetException;
 
 
 /**

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,11 +19,11 @@ package org.apache.velocity.runtime.pars
  * under the License.    
  */
 
+import org.slf4j.Logger;
+
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 
-import org.slf4j.Logger;
-
 /**
  * Abstract class that is used to execute an arbitrary
  * method that is in introspected. This is the superclass

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPropertyExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,13 +19,12 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.lang.reflect.InvocationTargetException;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
+
+import java.lang.reflect.InvocationTargetException;
 
 /**
  * Executor for looking up property names in the passed in class

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPublicFieldExecutor.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPublicFieldExecutor.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPublicFieldExecutor.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SetPublicFieldExecutor.java Sun Jul 17 23:33:09 2016
@@ -19,15 +19,14 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Modifier;
-
-import org.slf4j.Logger;
-
 import org.apache.commons.lang3.StringUtils;
 import org.apache.velocity.exception.VelocityException;
 import org.apache.velocity.util.introspection.Introspector;
+import org.slf4j.Logger;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Modifier;
 
 /**
  * Executor for setting public fields in objects

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/parser/node/SimpleNode.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,7 @@ package org.apache.velocity.runtime.pars
  * under the License.
  */
 
-import java.io.IOException;
-import java.io.Writer;
-import java.util.Arrays;
-
-import org.slf4j.Logger;
-
+import org.apache.velocity.Template;
 import org.apache.velocity.context.InternalContextAdapter;
 import org.apache.velocity.exception.MethodInvocationException;
 import org.apache.velocity.exception.ParseErrorException;
@@ -34,6 +29,11 @@ import org.apache.velocity.runtime.Runti
 import org.apache.velocity.runtime.parser.Parser;
 import org.apache.velocity.runtime.parser.Token;
 import org.apache.velocity.util.StringUtils;
+import org.slf4j.Logger;
+
+import java.io.IOException;
+import java.io.Writer;
+import java.util.Arrays;
 
 /**
  *
@@ -74,9 +74,7 @@ public class SimpleNode implements Node
     /** */
     protected Token last;
 
-
-    protected String templateName;
-
+    protected Template template;
 
     public RuntimeServices getRuntimeServices()
     {
@@ -99,7 +97,7 @@ public class SimpleNode implements Node
     {
         this(i);
         parser = p;
-        templateName = parser.currentTemplateName;
+        template = parser.currentTemplate;
     }
 
     /**
@@ -441,7 +439,9 @@ public class SimpleNode implements Node
 
 	public String getTemplateName()
     {
-      return templateName;
+      return template.getName();
     }
+
+    public Template getTemplate() { return template; }
 }
 

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ContentResource.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ContentResource.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ContentResource.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ContentResource.java Sun Jul 17 23:33:09 2016
@@ -19,12 +19,12 @@ package org.apache.velocity.runtime.reso
  * under the License.    
  */
 
-import java.io.StringWriter;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
 import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.exception.VelocityException;
 
+import java.io.BufferedReader;
+import java.io.StringWriter;
+
 /**
  * This class represent a general text resource that may have been
  * retrieved from any number of possible sources.

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/Resource.java Sun Jul 17 23:33:09 2016
@@ -19,14 +19,12 @@ package org.apache.velocity.runtime.reso
  * under the License.    
  */
 
-import org.apache.velocity.runtime.RuntimeServices;
+import org.apache.velocity.exception.ParseErrorException;
+import org.apache.velocity.exception.ResourceNotFoundException;
 import org.apache.velocity.runtime.RuntimeConstants;
-
+import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.resource.loader.ResourceLoader2;
 
-import org.apache.velocity.exception.ResourceNotFoundException;
-import org.apache.velocity.exception.ParseErrorException;
-
 /**
  * This class represent a general text resource that
  * may have been retrieved from any number of possible

Modified: velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCache.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCache.java?rev=1753137&r1=1753136&r2=1753137&view=diff
==============================================================================
--- velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCache.java (original)
+++ velocity/engine/trunk/velocity-engine-core/src/main/java/org/apache/velocity/runtime/resource/ResourceCache.java Sun Jul 17 23:33:09 2016
@@ -19,9 +19,10 @@ package org.apache.velocity.runtime.reso
  * under the License.    
  */
 
-import java.util.Iterator;
 import org.apache.velocity.runtime.RuntimeServices;
 
+import java.util.Iterator;
+
 /**
  * Interface that defines the shape of a pluggable resource cache
  *  for the included ResourceManager