You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@velocity.apache.org by by...@apache.org on 2008/12/30 05:18:12 UTC

svn commit: r730040 - in /velocity/engine/trunk/src/java/org/apache/velocity: app/VelocityEngine.java runtime/RuntimeInstance.java

Author: byron
Date: Mon Dec 29 20:18:11 2008
New Revision: 730040

URL: http://svn.apache.org/viewvc?rev=730040&view=rev
Log:
VELOCITY-659 Remove java.lang.Exception in throws clause of VelocityEngine methods.

Modified:
    velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java
    velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java

Modified: velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java?rev=730040&r1=730039&r2=730040&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/app/VelocityEngine.java Mon Dec 29 20:18:11 2008
@@ -73,11 +73,9 @@
      *  the engine using the properties file specified
      *
      * @param propsFilename name of properties file to init with
-     * @throws Exception
      * @since 1.5
      */
     public VelocityEngine(String propsFilename)
-        throws Exception
     {
         ri.init(propsFilename);
     }
@@ -87,11 +85,9 @@
      *  the engine using the Properties specified
      *
      * @param p name of properties  to init with
-     * @throws Exception
      * @since 1.5
      */
     public VelocityEngine(Properties p)
-        throws Exception
     {
         ri.init(p);
     }
@@ -99,10 +95,8 @@
     /**
      *  initialize the Velocity runtime engine, using the default
      *  properties of the Velocity distribution
-     * @throws Exception
      */
     public void init()
-        throws Exception
     {
         ri.init();
     }
@@ -113,10 +107,8 @@
      *
      *  @param propsFilename file containing properties to use to initialize
      *         the Velocity runtime
-     * @throws Exception
      */
     public void init(String propsFilename)
-        throws Exception
     {
         ri.init(propsFilename);
     }
@@ -126,11 +118,8 @@
      *  plus the properties in the passed in java.util.Properties object
      *
      *  @param p  Proprties object containing initialization properties
-     * @throws Exception
-     *
      */
     public void init(Properties p)
-        throws Exception
     {
         ri.init(p);
     }
@@ -209,12 +198,11 @@
      * @throws ParseErrorException The template could not be parsed.
      * @throws MethodInvocationException A method on a context object could not be invoked.
      * @throws ResourceNotFoundException A referenced resource could not be loaded.
-     * @throws IOException While rendering to the writer, an I/O problem occured.
      */
     public  boolean evaluate( Context context,  Writer out,
                                      String logTag, String instring )
         throws ParseErrorException, MethodInvocationException,
-            ResourceNotFoundException, IOException
+            ResourceNotFoundException
     {
         return ri.evaluate(context, out, logTag, instring);
     }
@@ -282,14 +270,12 @@
      * @throws ParseErrorException The template could not be parsed.
      * @throws MethodInvocationException A method on a context object could not be invoked.
      * @throws ResourceNotFoundException A referenced resource could not be loaded.
-     * @throws IOException While reading from the reader or rendering to the writer,
-     *                     an I/O problem occured.
      *  @since Velocity v1.1
      */
     public boolean evaluate(Context context, Writer writer,
                                     String logTag, Reader reader)
         throws ParseErrorException, MethodInvocationException,
-            ResourceNotFoundException,IOException
+            ResourceNotFoundException
     {
         return ri.evaluate(context, writer, logTag, reader);
     }
@@ -309,12 +295,10 @@
      * @param context Context object containing data/objects used for rendering.
      * @param writer  Writer for output stream
      * @return true if Velocimacro exists and successfully invoked, false otherwise.
-     * @throws IOException While rendering to the writer, an I/O problem occured.
      */
     public boolean invokeVelocimacro( String vmName, String logTag,
                                               String params[], Context context,
                                               Writer writer )
-        throws Exception
     {
         return ri.invokeVelocimacro(vmName, logTag, params, context, writer);
     }
@@ -333,14 +317,13 @@
      * @throws ResourceNotFoundException
      * @throws ParseErrorException
      * @throws MethodInvocationException
-     * @throws Exception
      * @deprecated Use
      *  {@link #mergeTemplate( String templateName, String encoding,
      *                Context context, Writer writer )}
      */
     public boolean mergeTemplate( String templateName,
                                          Context context, Writer writer )
-        throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception
+        throws ResourceNotFoundException, ParseErrorException, MethodInvocationException
     {
         return mergeTemplate( templateName, ri.getString(INPUT_ENCODING,ENCODING_DEFAULT),
                                context, writer );
@@ -359,13 +342,11 @@
      * @throws ResourceNotFoundException
      * @throws ParseErrorException
      * @throws MethodInvocationException
-     * @throws Exception
-     *
      *  @since Velocity v1.1
      */
     public boolean mergeTemplate( String templateName, String encoding,
                                       Context context, Writer writer )
-        throws ResourceNotFoundException, ParseErrorException, MethodInvocationException, Exception
+        throws ResourceNotFoundException, ParseErrorException, MethodInvocationException
     {
         Template template = ri.getTemplate(templateName, encoding);
 
@@ -393,10 +374,9 @@
      *          from any available source.
      * @throws ParseErrorException if template cannot be parsed due
      *          to syntax (or other) error.
-     * @throws Exception if an error occurs in template initialization
      */
     public Template getTemplate(String name)
-        throws ResourceNotFoundException, ParseErrorException, Exception
+        throws ResourceNotFoundException, ParseErrorException
     {
         return ri.getTemplate( name );
     }
@@ -412,12 +392,10 @@
      *          from any available source.
      * @throws ParseErrorException if template cannot be parsed due
      *          to syntax (or other) error.
-     * @throws Exception if an error occurs in template initialization
-     *
      *  @since Velocity v1.1
      */
     public Template getTemplate(String name, String encoding)
-        throws ResourceNotFoundException, ParseErrorException, Exception
+        throws ResourceNotFoundException, ParseErrorException
     {
         return ri.getTemplate( name, encoding );
     }

Modified: velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java
URL: http://svn.apache.org/viewvc/velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java?rev=730040&r1=730039&r2=730040&view=diff
==============================================================================
--- velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java (original)
+++ velocity/engine/trunk/src/java/org/apache/velocity/runtime/RuntimeInstance.java Mon Dec 29 20:18:11 2008
@@ -1192,11 +1192,10 @@
      * @throws ParseErrorException The template could not be parsed.
      * @throws MethodInvocationException A method on a context object could not be invoked.
      * @throws ResourceNotFoundException A referenced resource could not be loaded.
-     * @throws IOException While rendering to the writer, an I/O problem occured.
      * @since Velocity 1.6
      */
     public boolean evaluate(Context context,  Writer out,
-                            String logTag, String instring) throws IOException
+                            String logTag, String instring)
     {
         return evaluate(context, out, logTag, new StringReader(instring));
     }
@@ -1217,12 +1216,10 @@
      * @throws ParseErrorException The template could not be parsed.
      * @throws MethodInvocationException A method on a context object could not be invoked.
      * @throws ResourceNotFoundException A referenced resource could not be loaded.
-     * @throws IOException While reading from the reader or rendering to the writer,
-     *                     an I/O problem occured.
      * @since Velocity 1.6
      */
     public boolean evaluate(Context context, Writer writer,
-                            String logTag, Reader reader) throws IOException
+                            String logTag, Reader reader)
     {
         if (logTag == null)
         {
@@ -1269,11 +1266,10 @@
      * @throws ParseErrorException The template could not be parsed.
      * @throws MethodInvocationException A method on a context object could not be invoked.
      * @throws ResourceNotFoundException A referenced resource could not be loaded.
-     * @throws IOException While rendering to the writer, an I/O problem occured.
      * @since Velocity 1.6
      */
     public boolean render(Context context, Writer writer,
-                          String logTag, SimpleNode nodeTree) throws IOException
+                          String logTag, SimpleNode nodeTree)
     {
         /*
          * we want to init then render
@@ -1307,10 +1303,14 @@
                 throw new VelocityException(msg, e);
             }
 
-            /*
-             *  now render, and let any exceptions fly
-             */
-            nodeTree.render(ica, writer);
+            try
+            {
+                nodeTree.render(ica, writer);
+            } 
+            catch (IOException e)
+            {
+                throw new VelocityException("IO Error in writer: " + e.getMessage(), e);
+            }
         }
         finally
         {
@@ -1334,14 +1334,12 @@
      * @param context Context object containing data/objects used for rendering.
      * @param writer  Writer for output stream
      * @return true if Velocimacro exists and successfully invoked, false otherwise.
-     * @throws IOException While rendering to the writer, an I/O problem occured.
      * @since 1.6
      */
     public boolean invokeVelocimacro(final String vmName, String logTag,
                                      String[] params, final Context context,
                                      final Writer writer)
-        throws IOException
-    {
+     {
         /* check necessary parameters */
         if (vmName == null || context == null || writer == null)
         {