sharanggupta opened a new pull request, #68:
URL: https://github.com/apache/velocity-engine/pull/68

   Fixes [VELOCITY-998](https://issues.apache.org/jira/browse/VELOCITY-998).
   
   `EventHandlerUtil.methodException()` returns the result of the context event 
cartridge as soon as the context has one, but 
`EventCartridge.methodException()` returns `null` when the cartridge holds no 
`MethodExceptionEventHandler`. So attaching a cartridge with only other 
handlers, for example a `ReferenceInsertionEventHandler`, silently swallows the 
exception thrown by a method called from a template: `$woogie.doException()` 
renders literally instead of throwing `MethodInvocationException`.
   
   As suggested in the ticket, the context cartridge is now only used when it 
holds a method exception handler (`hasMethodExceptionEventHandler()`), as is 
already done for the application cartridge two lines above. Otherwise the 
exception is rethrown, as without a context cartridge.
   
   **Test:** 
`MethodInvocationExceptionTestCase.testMethodInvocationExceptionWithContextCartridgeWithoutHandler`
 attaches a context cartridge holding only a reference insertion handler and 
expects the `MethodInvocationException`. On `master` it fails with `No 
exception thrown, output: $woogie.doException() boing!`; with the change it 
passes, and `mvn -pl velocity-engine-core -am verify` passes locally.
   
   I did not touch `src/changes/changes.xml` since 2.5 is released and there is 
no 2.6 section yet; happy to add an entry if you tell me where you want it.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to