velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r551651 - /velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolContext.java
Date Thu, 28 Jun 2007 18:24:47 GMT
Author: nbubna
Date: Thu Jun 28 11:24:45 2007
New Revision: 551651

URL: http://svn.apache.org/viewvc?view=rev&rev=551651
Log:
let all interested tools know when a MethodExceptionEventHandler is running

Modified:
    velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolContext.java

Modified: velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolContext.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolContext.java?view=diff&rev=551651&r1=551650&r2=551651
==============================================================================
--- velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolContext.java (original)
+++ velocity/tools/branches/2.x/src/main/java/org/apache/velocity/tools/ToolContext.java Thu
Jun 28 11:24:45 2007
@@ -43,6 +43,7 @@
     public static final String CONTEXT_KEY = "velocityContext";
     public static final String ENGINE_KEY = "velocityEngine";
     public static final String LOG_KEY = "log";
+    public static final String CATCH_EXCEPTIONS_KEY = "catchExceptions";
 
     private List<Toolbox> toolboxes;
     // this is meant solely for tool setup,
@@ -58,6 +59,15 @@
         // add the engine and log as common tool properties
         putToolProperty(ENGINE_KEY, engine);
         putToolProperty(LOG_KEY, engine.getLog());
+
+        // tell interested tools not to catch exceptions whenever there's a
+        // method exception event handler configured for the engine
+        Object ehme =
+            engine.getProperty(VelocityEngine.EVENTHANDLER_METHODEXCEPTION);
+        if (ehme != null)
+        {
+            putToolProperty(CATCH_EXCEPTIONS_KEY, Boolean.FALSE);
+        }
     }
 
     public ToolContext(Map<String,Object> toolProps)



Mime
View raw message