You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Urban Peter <ur...@jaist.ac.jp> on 2004/04/24 11:09:23 UTC
[PATCH] for bug 21173 about AnakiaTask / templatePath
Hi to all,
you can find below a patch for bug 21173: "AnakiaTask does not store
templatePath if props file found."
(Please ignore the patch that I submitted to Bugzilla in January.)
The fix makes sure that templatePath is processed even if the properties
file is found (an "else if" branch became an independent "if"). This is
the correct, documented behavior of templatePath.
I also simplified the code: ve.init now only appears once. Without this
change, the fix would have been longer/uglier.
Please complain if anything's wrong -- this is the first time I'm
submitting a patch to Velocity.
Ciao,
Peter
Index: AnakiaTask.java
===================================================================
RCS file:
/home/cvspublic/jakarta-velocity/src/java/org/apache/velocity/anakia/A
nakiaTask.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 24 Apr 2004 08:48:49 -0000
@@ -24,6 +24,8 @@
import java.util.StringTokenizer;
+import org.apache.commons.collections.ExtendedProperties;
+
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.DirectoryScanner;
import org.apache.tools.ant.Project;
@@ -261,14 +263,19 @@
{
if ( velocityPropertiesFile.exists() )
{
- ve.init(velocityPropertiesFile.getAbsolutePath());
+ String file = velocityPropertiesFile.getAbsolutePath();
+ ExtendedProperties config = new
ExtendedProperties(file);
+ ve.setExtendedProperties(config);
}
- else if (templatePath != null && templatePath.length() > 0)
+
+ // override the templatePath if it exists
+ if (templatePath != null && templatePath.length() > 0)
{
ve.setProperty(
RuntimeConstants.FILE_RESOURCE_LOADER_PATH,
templatePath);
- ve.init();
}
+
+ ve.init();
// 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