You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by "Waldemar Baraldi (JIRA)" <ji...@apache.org> on 2006/03/20 14:41:59 UTC

[jira] Created: (VELOCITY-436) Remove "Exception" type throwing.

Remove "Exception" type throwing.
---------------------------------

         Key: VELOCITY-436
         URL: http://issues.apache.org/jira/browse/VELOCITY-436
     Project: Velocity
        Type: Improvement
  Components: Source  
 Environment: NA
    Reporter: Waldemar Baraldi
    Priority: Trivial


I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (VELOCITY-436) Remove "Exception" type throwing.

Posted by "Brian Ewins (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-436?page=comments#action_12402336 ] 

Brian Ewins commented on VELOCITY-436:
--------------------------------------

I was just passing through wondering if this very issue had been discussed - since you ask, pretty much every method of VelocityEngine 'throws Exception', its 'orrible. Specific examples would be eg

public void init() throws java.lang.Exception

or 

public Template getTemplate(java.lang.String name)
                     throws ResourceNotFoundException, ParseErrorException, java.lang.Exception

In this case (but not every case) the java.lang.Exception is actually documented as having a specific reason. Examples of this are everywhere though, its not just VelocityEngine; Velocity and VelocityEngine are just passing through any Exception thrown in RuntimeInstance, including ones created like this:

throw new Exception(err);

(in RuntimeInstance.initializeIntrospection(), and throughout that class). If those were changed to throw new VelocityException(err) it seems the 'throws Exception' wouldn't be necessary in any of these classes.

A related issue with these particular exceptions is that they are being logged when they are thrown. This will inevitably lead to double-logging of errors; since not every error can be logged at the point it is thrown (eg an NPE) its more common to throw the exception and assume the user will log it when the exception is consumed. Its especially true right now, since its impossible to distinguish exceptions thrown by Velocity (which are already logged) from exceptions thrown by Velocity for other reasons (which are not logged) or java.lang.Exceptions from anywhere else (which are also not logged)


> Remove "Exception" type throwing.
> ---------------------------------
>
>          Key: VELOCITY-436
>          URL: http://issues.apache.org/jira/browse/VELOCITY-436
>      Project: Velocity
>         Type: Improvement

>   Components: Source
>  Environment: NA
>     Reporter: Waldemar Baraldi
>     Priority: Trivial

>
> I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (VELOCITY-436) Remove "Exception" type throwing.

Posted by "Waldemar Baraldi (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-436?page=comments#action_12415865 ] 

Waldemar Baraldi commented on VELOCITY-436:
-------------------------------------------

The main method I am refering to is:
class Template 
method merge(Context context, java.io.Writer writer) 

from the javadoc:

public void merge(Context context,
                  java.io.Writer writer)
           throws ResourceNotFoundException,
                  ParseErrorException,
                  MethodInvocationException,
                  java.lang.Exception;

Hope this comment helps.



> Remove "Exception" type throwing.
> ---------------------------------
>
>          Key: VELOCITY-436
>          URL: http://issues.apache.org/jira/browse/VELOCITY-436
>      Project: Velocity
>         Type: Improvement

>   Components: Source
>  Environment: NA
>     Reporter: Waldemar Baraldi
>     Priority: Trivial

>
> I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Commented: (VELOCITY-436) Remove "Exception" type throwing.

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/VELOCITY-436?page=comments#action_12374760 ] 

Will Glass-Husain commented on VELOCITY-436:
--------------------------------------------

Thanks for the note.  Are there methods in particular that you were thinking of?  A few examples would be helpful.

> Remove "Exception" type throwing.
> ---------------------------------
>
>          Key: VELOCITY-436
>          URL: http://issues.apache.org/jira/browse/VELOCITY-436
>      Project: Velocity
>         Type: Improvement

>   Components: Source
>  Environment: NA
>     Reporter: Waldemar Baraldi
>     Priority: Trivial

>
> I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


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


[jira] Closed: (VELOCITY-436) Remove "Exception" type throwing.

Posted by "Henning Schmiedehausen (JIRA)" <de...@velocity.apache.org>.
     [ https://issues.apache.org/jira/browse/VELOCITY-436?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henning Schmiedehausen closed VELOCITY-436.
-------------------------------------------


> Remove "Exception" type throwing.
> ---------------------------------
>
>                 Key: VELOCITY-436
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-436
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Engine
>         Environment: NA
>            Reporter: Waldemar Baraldi
>            Priority: Trivial
>             Fix For: 1.5
>
>
> I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (VELOCITY-436) Remove "Exception" type throwing.

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-436?page=all ]

Will Glass-Husain updated VELOCITY-436:
---------------------------------------

    Fix Version/s: 1.5

> Remove "Exception" type throwing.
> ---------------------------------
>
>                 Key: VELOCITY-436
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-436
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Source
>         Environment: NA
>            Reporter: Waldemar Baraldi
>            Priority: Trivial
>             Fix For: 1.5
>
>
> I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] Resolved: (VELOCITY-436) Remove "Exception" type throwing.

Posted by "Will Glass-Husain (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/VELOCITY-436?page=all ]

Will Glass-Husain resolved VELOCITY-436.
----------------------------------------

    Resolution: Fixed

removed generic Exception throwing from Template.merge, and in fact many methods (including all public Template methods).

> Remove "Exception" type throwing.
> ---------------------------------
>
>                 Key: VELOCITY-436
>                 URL: http://issues.apache.org/jira/browse/VELOCITY-436
>             Project: Velocity
>          Issue Type: Improvement
>          Components: Source
>         Environment: NA
>            Reporter: Waldemar Baraldi
>            Priority: Trivial
>
> I have to use Checkstyle coding standards at my job. Some methos of Velocity throw exceptions using the raw "Exception" type. So Checkstyle points an error everywhere I use Velocity and, unfortunately, that's a fact I cannot override in my source code. So it would be nice if those "throws Exception" are replaced by some Velocity proper exception.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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