commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r423537 - /jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/expression/MethodExpression.java
Date Wed, 19 Jul 2006 17:31:45 GMT
Author: rdonkin
Date: Wed Jul 19 10:31:44 2006
New Revision: 423537

URL: http://svn.apache.org/viewvc?rev=423537&view=rev
Log:
Improved diagnostic logging. Contributed by Holger Haag. JIRA BETWIXT-53.

Modified:
    jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/expression/MethodExpression.java

Modified: jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/expression/MethodExpression.java
URL: http://svn.apache.org/viewvc/jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/expression/MethodExpression.java?rev=423537&r1=423536&r2=423537&view=diff
==============================================================================
--- jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/expression/MethodExpression.java
(original)
+++ jakarta/commons/proper/betwixt/trunk/src/java/org/apache/commons/betwixt/expression/MethodExpression.java
Wed Jul 19 10:31:44 2006
@@ -62,9 +62,10 @@
                 
             } catch (IllegalAccessException e) {
                 // lets try use another method with the same name
+                Method alternate = null;
                 try {
                     Class type = bean.getClass();
-                    Method alternate = findAlternateMethod( type, method );
+                    alternate = findAlternateMethod( type, method );
                     if ( alternate != null ) {
                         try
                         {
@@ -80,10 +81,10 @@
                         return method.invoke( bean, arguments );
                     }
                 } catch (Exception e2) {
-                    handleException(context, e2);
+                    handleException(context, e2, alternate);
                 }
             } catch (Exception e) {
-                handleException(context, e);
+                handleException(context, e, method);
             }
         }
         return null;
@@ -169,10 +170,23 @@
       * @param context the Context being evaluated when the exception occured
       * @param e the exception to handle
       */
-    protected void handleException(Context context, Exception e) {
+    protected void handleException(Context context, Exception e, Method m) {
         // use the context's logger to log the problem
-        context.getLog().error("[MethodExpression] Cannot evaluate expression ", e);
+        context.getLog().error("[MethodExpression] Cannot evaluate method " + m, e);
     }
+    
+    /** 
+     * <p>Log error to context's logger.</p> 
+     *
+     * <p>Allows derived objects to handle exceptions differently.</p>
+     *
+     * @param context the Context being evaluated when the exception occured
+     * @param e the exception to handle
+     */
+   protected void handleException(Context context, Exception e) {
+       // use the context's logger to log the problem
+       context.getLog().error("[MethodExpression] Cannot evaluate method ", e);
+   }
     
     /** 
      * Returns something useful for logging.



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


Mime
View raw message