velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r685377 - in /velocity/engine/trunk/src/java/org/apache/velocity: Template.java runtime/resource/ContentResource.java runtime/resource/ResourceManagerImpl.java
Date Tue, 12 Aug 2008 23:47:10 GMT
Author: nbubna
Date: Tue Aug 12 16:47:09 2008
New Revision: 685377

URL: http://svn.apache.org/viewvc?rev=685377&view=rev
Log:
fix small resource bugs found via VELOCITY-607 testing (thx to Jarkko Viinamaki)

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/Template.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ContentResource.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/Template.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/Template.java?rev=685377&r1=685376&r2=685377&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/Template.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/Template.java Tue Aug 12 16:47:09 2008
@@ -37,6 +37,7 @@
 import org.apache.velocity.runtime.parser.ParseException;
 import org.apache.velocity.runtime.parser.node.SimpleNode;
 import org.apache.velocity.runtime.resource.Resource;
+import org.apache.velocity.runtime.resource.ResourceManager;
 
 /**
  * This class is used for controlling all template
@@ -67,6 +68,9 @@
     /** Default constructor */
     public Template()
     {
+        super();
+        
+        setType(ResourceManager.RESOURCE_TEMPLATE);
     }
 
     /**
@@ -117,7 +121,6 @@
             try
             {
                 BufferedReader br = new BufferedReader( new InputStreamReader( is, encoding
) );
-
                 data = rsvc.parse( br, name);
                 initDocument();
                 return true;
@@ -148,7 +151,7 @@
              */
             catch( RuntimeException e )
             {
-                throw e;
+                throw new RuntimeException("Exception thrown processing Template "+getName(),
e);
             }
             finally
             {
@@ -346,6 +349,3 @@
         }
     }
 }
-
-
-

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ContentResource.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ContentResource.java?rev=685377&r1=685376&r2=685377&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ContentResource.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ContentResource.java
Tue Aug 12 16:47:09 2008
@@ -41,6 +41,9 @@
     /** Default empty constructor */
     public ContentResource()
     {
+        super();
+        
+        setType(ResourceManager.RESOURCE_CONTENT);
     }
 
     /**

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java?rev=685377&r1=685376&r2=685377&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
(original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/resource/ResourceManagerImpl.java
Tue Aug 12 16:47:09 2008
@@ -504,7 +504,7 @@
          * the input stream and parse it to make a new
          * AST for the resource.
          */
-            
+
         /*
          *  touch() the resource to reset the counters
          */
@@ -540,7 +540,7 @@
              * we create a copy to avoid partially overwriting a
              * template which may be in use in another thread
              */ 
-   
+
             Resource newResource = 
                 ResourceFactory.getResource(resource.getName(), resource.getType());
 
@@ -548,6 +548,7 @@
             newResource.setName(resource.getName());
             newResource.setEncoding(resource.getEncoding());
             newResource.setResourceLoader(resource.getResourceLoader());
+            newResource.setModificationCheckInterval(resource.getResourceLoader().getModificationCheckInterval());
 
             newResource.process();
             newResource.setLastModified(howOldItWas);



Mime
View raw message