You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by bu...@apache.org on 2004/09/06 12:10:22 UTC

DO NOT REPLY [Bug 31073] New: - velocity.properties and templatePath could not be specified together

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=31073>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=31073

velocity.properties and templatePath could not be specified together

           Summary: velocity.properties and templatePath could not be
                    specified together
           Product: Velocity
           Version: 1.4
          Platform: PC
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: Other
         Component: Anakia
        AssignedTo: velocity-dev@jakarta.apache.org
        ReportedBy: kitora@qu-bit.com


In Ant Anakia task ,
I counld not specify 'templatePath' attribute
when velocity.properties file exists.

 I fixed this problem , please check my patch

===================================================================
RCS file:
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/anakia/AnakiaTask.java,v
retrieving revision 1.38
diff -u -r1.38 AnakiaTask.java
--- AnakiaTask.java	20 Mar 2004 03:35:50 -0000	1.38
+++ AnakiaTask.java	6 Sep 2004 10:01:14 -0000
@@ -19,10 +19,12 @@
 import java.io.BufferedWriter;
 import java.io.File;
 import java.io.FileOutputStream;
+import java.io.FileInputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
 
 import java.util.StringTokenizer;
+import java.util.Properties;
 
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
@@ -259,16 +261,17 @@
         Document projectDocument = null;
         try
         {
+            Properties vp = new Properties();
             if ( velocityPropertiesFile.exists() )
             {
-                ve.init(velocityPropertiesFile.getAbsolutePath());
+                vp.load( new
FileInputStream(velocityPropertiesFile.getAbsolutePath()) );
             }
-            else if (templatePath != null && templatePath.length() > 0)
+            if (templatePath != null && templatePath.length() > 0)
             {
-                ve.setProperty( RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
+                vp.setProperty(RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
                     templatePath);
-                ve.init();
             }
+            ve.init(vp);
 
             // get the last modification of the VSL stylesheet
             styleSheetLastModified = ve.getTemplate( style ).getLastModified();

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-dev-help@jakarta.apache.org