jvanzyl     01/08/31 13:18:24

  Modified:    src/java/org/apache/velocity/texen/ant TexenTask.java
  Log:
  - corrected logic in processing context properties. common in situ.
  
  Revision  Changes    Path
  1.30      +12 -13    
jakarta-velocity/src/java/org/apache/velocity/texen/ant/TexenTask.java
  
  Index: TexenTask.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/texen/ant/TexenTask.java,v
  retrieving revision 1.29
  retrieving revision 1.30
  diff -u -r1.29 -r1.30
  --- TexenTask.java    2001/08/29 02:37:27     1.29
  +++ TexenTask.java    2001/08/31 20:18:24     1.30
  @@ -86,7 +86,7 @@
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Jason van Zyl</a>
    * @author <a href="[EMAIL PROTECTED]">Robert Burrell Donkin</a>
  - * @version $Id: TexenTask.java,v 1.29 2001/08/29 02:37:27 jvanzyl Exp $
  + * @version $Id: TexenTask.java,v 1.30 2001/08/31 20:18:24 jvanzyl Exp $
    */
   public class TexenTask 
       extends Task
  @@ -260,7 +260,17 @@
       {
           contextProperties = new ExtendedProperties();
           
  -        if (useClasspath)
  +        // Always try to get the context properties resource
  +        // from a file first. Templates may be taken from a JAR
  +        // file but the context properties resource may be a 
  +        // resource in the filesystem. If this fails than attempt
  +        // to get the context properties resource from the
  +        // classpath.
  +        try
  +        {
  +            contextProperties.load(new FileInputStream(file));
  +        }
  +        catch (Exception e)
           {
               ClassLoader classLoader = this.getClass().getClassLoader();
               
  @@ -270,17 +280,6 @@
                   contextProperties.load(inputStream);
               }
               catch (IOException ioe)
  -            {
  -                contextProperties = null;
  -            }
  -        }
  -        else
  -        {
  -            try
  -            {
  -                contextProperties.load(new FileInputStream(file));
  -            }
  -            catch (Exception e)
               {
                   contextProperties = null;
               }
  
  
  

Reply via email to