cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jiri Luzny <jiri_lu...@yahoo.com>
Subject Re: "redirect-to resource" and substitution of the List of Maps
Date Thu, 31 May 2001 10:11:18 GMT
Could you guys commit the patch to cvs? It is just better exception
handling of the AbstractSitemap.invokeMethod().
 
thank you,
 
Jiri.

btw: is there any specification of proper exception handling used in Cocoon?



===================================================================
RCS file: /home/cvspublic/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
retrieving revision 1.2
diff -u -r1.2 AbstractSitemap.java
--- AbstractSitemap.java	2001/05/18 11:04:23	1.2
+++ AbstractSitemap.java	2001/05/29 12:26:24
@@ -262,13 +262,19 @@
      * @exception Exception If an error occurs during method invocation
      */
     protected boolean invokeMethod(String methodName, Class[] argTypes, Object[] argValues)
throws Exception {
-      try {
-        java.lang.reflect.Method method = this.getClass().getDeclaredMethod(methodName,
argTypes);
-        return ((Boolean) method.invoke(this, argValues)).booleanValue();
-      } catch (Exception e) {
-        throw new Exception ("Sitemap: " + methodName + " not found");
-      }
-    }
+        try {
+            getLogger().debug("Dynamically invoking " + methodName);
+            java.lang.reflect.Method method = this.getClass().getDeclaredMethod(methodName,
argTypes);
+            return ((Boolean) method.invoke(this, argValues)).booleanValue();
+        } catch (NoSuchMethodException e) {
+            getLogger().error("AbstractSitemap:invokeMethod()", e);
+            int prefix = methodName.indexOf("_");
+            throw new Exception ("Sitemap: " + methodName.substring(0,prefix) + " '" +
methodName.substring(prefix + 1) + "' not found");
+        } catch (Exception e) {
+            getLogger().error("AbstractSitemap:invokeMethod()", e);
+            throw e;
+        }
+   }
 
     /**
      * dispose



__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35 
a year!  http://personal.mail.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message