You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by by...@apache.org on 2009/01/19 11:15:10 UTC

svn commit: r735644 - in /velocity/engine/trunk/src: java/org/apache/velocity/context/ java/org/apache/velocity/runtime/directive/ parser/

Author: byron
Date: Mon Jan 19 02:15:09 2009
New Revision: 735644

URL: http://svn.apache.org/viewvc?rev=735644&view=rev
Log:
VELOCITY-668 Performance and cleanup

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Break.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
    velocity/engine/trunk/src/parser/Parser.jjt

Modified: velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java?rev=735644&r1=735643&r2=735644&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/context/ProxyVMContext.java Mon Jan 19 02:15:09 2009
@@ -307,8 +307,10 @@
     public Object remove(Object key)
     {
         Object loc = localcontext.remove(key);
-        Object arg = vmproxyhash.remove(key);
         Object glo = null;
+        
+        vmproxyhash.remove(key);
+        
         if (!localContextScope)
         {
             glo = super.remove(key);

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java?rev=735644&r1=735643&r2=735644&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/BlockMacro.java Mon Jan 19 02:15:09 2009
@@ -134,7 +134,7 @@
      * With this we can have reference to the output Writer in ProxyVMContext.get call.
      * This approach lets us write directly to the output instead of using costly StringWriter.
      */
-    public class BlockMacroContainer extends SimpleNode
+    public static class BlockMacroContainer extends SimpleNode
     {
         private Node node;
         private Writer w;

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Break.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Break.java?rev=735644&r1=735643&r2=735644&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Break.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/Break.java Mon Jan 19 02:15:09 2009
@@ -48,6 +48,7 @@
  */
 public class Break extends Directive
 {
+    private static final RuntimeException BREAK = new BreakException();
     /**
      * Return name of this directive.
      * @return The name of this directive.
@@ -102,14 +103,14 @@
         throws IOException,  MethodInvocationException, ResourceNotFoundException,
         	ParseErrorException
     {
-        throw new BreakException();
+        throw BREAK;
     }
     
     public static class BreakException extends RuntimeException 
     {
         public BreakException()
         {
-          // If a break is thrown threw a macro or parse call, then this exception
+          // If a break is thrown during a macro or parse call, then this exception
           // will be logged because this method calls catch
           // RuntimeException, so provide the user with some info.
           super("Break");

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java?rev=735644&r1=735643&r2=735644&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/directive/VelocimacroProxy.java Mon Jan 19 02:15:09 2009
@@ -51,7 +51,6 @@
     private String[] literalArgArray = null;
     private SimpleNode nodeTree = null;
     private int numMacroArgs = 0;
-    private boolean preInit = false;
     private boolean strictArguments;
     private boolean localContextScope = false;
     private int maxCallDepth;

Modified: velocity/engine/trunk/src/parser/Parser.jjt
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/parser/Parser.jjt?rev=735644&r1=735643&r2=735644&view=diff
==============================================================================
--- velocity/engine/trunk/src/parser/Parser.jjt (original)
+++ velocity/engine/trunk/src/parser/Parser.jjt Mon Jan 19 02:15:09 2009
@@ -441,7 +441,7 @@
     /**
      * Holds the state of the parsing process.
      */
-    private class ParserState
+    private static class ParserState
     {
         int lparen;
         int rparen;