[java-support] branch master updated: IDP-861 catch exceptions in templating

Rod Widdowson rdw at steadingsoftware.com
Thu Nov 12 12:04:26 EST 2015


This is an automated email from the git hooks/post-receive script.

rdw pushed a commit to branch master
in repository java-support.

The following commit(s) were added to refs/heads/master by this push:
       new  4eee20f   IDP-861 catch exceptions in templating
4eee20f is described below

commit 4eee20faef3466cc75aca227b95e9dea03368ec8
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Nov 12 17:00:52 2015 +0000

    IDP-861 catch exceptions in templating
    
    https://issues.shibboleth.net/jira/browse/IDP-861
    
    Catch all exceptions and rethrow them as the (assumedly) expected VelocityException.
    The upper layers will/should chatch this
---
 .../net/shibboleth/utilities/java/support/velocity/Template.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java b/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
index 8d8b520..8093e49 100644
--- a/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
+++ b/src/main/java/net/shibboleth/utilities/java/support/velocity/Template.java
@@ -231,11 +231,13 @@ public final class Template {
         } catch (ResourceNotFoundException e) {
             throw new VelocityException("Velocity template " + templateName
                     + " has been removed since this object was constructed");
+        } catch (Exception e) {
+            throw new VelocityException("Velocity template " + templateName + " threw an exception", e);
         }
     }
 
     /** {@inheritDoc} */
-    public boolean equals(Object obj) {
+    @Override public boolean equals(Object obj) {
         if (obj == null) {
             return false;
         }
@@ -253,12 +255,12 @@ public final class Template {
     }
 
     /** {@inheritDoc} */
-    public int hashCode() {
+    @Override public int hashCode() {
         return Objects.hashCode(engine, templateName);
     }
 
     /** {@inheritDoc} */
-    public String toString() {
+    @Override public String toString() {
         return MoreObjects.toStringHelper(this).add("templateName", templateName).toString();
     }
 }
\ No newline at end of file

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list