[ 
https://issues.apache.org/jira/browse/VELOCITY-998?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Claude Brisson resolved VELOCITY-998.
-------------------------------------
    Fix Version/s: 2.5
         Assignee: Claude Brisson
       Resolution: Fixed

Fixed by PR #68.

> Exception swallowed when context cartrige with no method exception handler
> --------------------------------------------------------------------------
>
>                 Key: VELOCITY-998
>                 URL: https://issues.apache.org/jira/browse/VELOCITY-998
>             Project: Velocity
>          Issue Type: Bug
>          Components: Engine
>    Affects Versions: 2.4.1
>            Reporter: Peter SEVERIN
>            Assignee: Claude Brisson
>            Priority: Minor
>             Fix For: 2.5
>
>
> The EventHandlerUtil.methodException method can swallow the exception if 
> there is a context EventCartrige with no method exception handler attached. 
> The following code calls EventCartrige#methodException method:
> {code:java}
>             EventCartridge contextCartridge = context.getEventCartridge();
>             if (contextCartridge != null)
>             {
>                 contextCartridge.setRuntimeServices(rsvc);
>                 return contextCartridge.methodException(context, claz, 
> method, e, info);
> {code}
> Which looks like this:
>  
> {code:java}
>         if (methodExceptionHandler != null)
>         {
>             return methodExceptionHandler.methodException(context, claz, 
> method, e, info);
>         }
>         return null;
> {code}
>  
> When no method exception handler is set the method returns null and the 
> exception is lost. This should not be the case as the behavior is different 
> when there is no context EventCartrige.
> The fix should looks like this:
>  
> {code:java}
>             EventCartridge contextCartridge = context.getEventCartridge();
>             if (contextCartridge != null && 
> contextCartridge.hasMethodExceptionEventHandler())
>             {
>                 contextCartridge.setRuntimeServices(rsvc);
>                 return contextCartridge.methodException(context, claz, 
> method, e, info);
>             }
> {code}
>  
>  



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to