You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by nb...@apache.org on 2008/08/15 20:45:06 UTC

svn commit: r686315 - /velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java

Author: nbubna
Date: Fri Aug 15 11:45:05 2008
New Revision: 686315

URL: http://svn.apache.org/viewvc?rev=686315&view=rev
Log:
VELOCITY-570 apply Jacob Mundt's patch to fix OOM errors caused by Ronald's fix

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java?rev=686315&r1=686314&r2=686315&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/parser/VelocityCharStream.java Fri Aug 15 11:45:05 2008
@@ -40,7 +40,7 @@
 {
     public static final boolean staticFlag = false;
     int bufsize;
-    private int nextBufExpand = 2048;
+    private int nextBufExpand;
     int available;
     int tokenBegin;
 
@@ -106,7 +106,7 @@
 
 
         bufsize += nextBufExpand;
-        nextBufExpand *= 2;
+        nextBufExpand = bufsize;
         available = bufsize;
         tokenBegin = 0;
     }
@@ -329,7 +329,7 @@
         line = startline;
         column = startcolumn - 1;
 
-        available = bufsize = buffersize;
+        available = bufsize = nextBufExpand = buffersize;
         buffer = new char[buffersize];
         bufline = new int[buffersize];
         bufcolumn = new int[buffersize];
@@ -360,7 +360,7 @@
 
         if (buffer == null || buffersize != buffer.length)
         {
-            available = bufsize = buffersize;
+            available = bufsize = nextBufExpand = buffersize;
             buffer = new char[buffersize];
             bufline = new int[buffersize];
             bufcolumn = new int[buffersize];