Uploaded image for project: 'Velocity'
  1. Velocity
  2. VELOCITY-293

velocity.properties and templatePath could not be specified together

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Duplicate
    • 1.4
    • None
    • Anakia
    • None
    • Operating System: other
      Platform: PC
    • 31073

    Description

      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();

      Attachments

        Activity

          People

            Unassigned Unassigned
            kitora@qu-bit.com KITORA Masanao
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: