velocity-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject cvs commit: jakarta-velocity/src/java/org/apache/velocity/texen/ant TexenTask.java
Date Sat, 03 Nov 2001 18:30:14 GMT
dlr         01/11/03 10:30:14

  Modified:    src/java/org/apache/velocity/texen/ant TexenTask.java
  Log:
  o Renamed MSG_CONSULT_LOG to ERR_MSG_FRAGMENT and provided more useful
  debugging information in the message.
  
  o Added cleanup() hook method to be overridden in subclasses.
  
  Revision  Changes    Path
  1.36      +26 -11    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.35
  retrieving revision 1.36
  diff -u -u -r1.35 -r1.36
  --- TexenTask.java	2001/10/24 05:20:55	1.35
  +++ TexenTask.java	2001/11/03 18:30:14	1.36
  @@ -82,17 +82,19 @@
    *
    * @author <a href="mailto:jvanzyl@apache.org">Jason van Zyl</a>
    * @author <a href="robertdonkin@mac.com">Robert Burrell Donkin</a>
  - * @version $Id: TexenTask.java,v 1.35 2001/10/24 05:20:55 jvanzyl Exp $
  + * @version $Id: TexenTask.java,v 1.36 2001/11/03 18:30:14 dlr Exp $
    */
   public class TexenTask 
       extends Task
   {
       /**
  -     * This message (telling users to consult the log) is appended to
  -     * rethrown exception messages.
  -     */
  -    private final static String MSG_CONSULT_LOG = 
  -        ". For more information consult the velocity log.";
  +     * This message fragment (telling users to consult the log or
  +     * invoke ant with the -debug flag) is appended to rethrown
  +     * exception messages.
  +     */
  +    private final static String ERR_MSG_FRAGMENT = 
  +        ". For more information consult the velocity log, or invoke ant " +
  +        "with the -debug flag.";
       
       /**
        * This is the control template that governs the output.
  @@ -363,7 +365,6 @@
       public void execute () 
           throws BuildException
       {
  -
           // Make sure the template path is set.
           if (templatePath == null && useClasspath == false)
           {
  @@ -521,6 +522,7 @@
               writer.flush();
               writer.close();
               generator.shutdown();
  +            cleanup();
           }
           catch( BuildException e)
           {
  @@ -530,20 +532,20 @@
           {
               throw new BuildException(
                   "Exception thrown by '" + e.getReferenceName() + "." + 
  -                    e.getMethodName() +"'" + MSG_CONSULT_LOG,
  +                    e.getMethodName() +"'" + ERR_MSG_FRAGMENT,
                           e.getWrappedThrowable());
           }       
           catch( ParseErrorException e )
           {
  -            throw new BuildException("Velocity syntax error" + MSG_CONSULT_LOG ,e);
  +            throw new BuildException("Velocity syntax error" + ERR_MSG_FRAGMENT ,e);
           }        
           catch( ResourceNotFoundException e )
           {
  -            throw new BuildException("Resource not found" + MSG_CONSULT_LOG,e);
  +            throw new BuildException("Resource not found" + ERR_MSG_FRAGMENT,e);
           }
           catch( Exception e )
           {
  -            throw new BuildException("Generation failed" + MSG_CONSULT_LOG ,e);
  +            throw new BuildException("Generation failed" + ERR_MSG_FRAGMENT ,e);
           }
       }
   
  @@ -568,5 +570,18 @@
           throws Exception
       {
           context.put("now", new Date().toString());
  +    }
  +
  +    /**
  +     * A hook method called at the end of {@link #execute()} which can
  +     * be overridden to perform any necessary cleanup activities (such
  +     * as the release of database connections, etc.).  By default,
  +     * does nothing.
  +     *
  +     * @exception Exception Problem cleaning up.
  +     */
  +    protected void cleanup()
  +        throws Exception
  +    {
       }
   }
  
  
  

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


Mime
View raw message