dims        01/05/31 03:54:16

  Modified:    src/org/apache/cocoon/sitemap AbstractSitemap.java
  Log:
  Patch for better exception handling in "redirect-to resource" and substitution of 
the List of Maps
  from Jiri Luzny ([EMAIL PROTECTED])
  
  Revision  Changes    Path
  1.3       +13 -8     xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java
  
  Index: AbstractSitemap.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/AbstractSitemap.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AbstractSitemap.java      2001/05/18 11:04:23     1.2
  +++ AbstractSitemap.java      2001/05/31 10:54:14     1.3
  @@ -44,7 +44,7 @@
    * Base class for generated <code>Sitemap</code> classes
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2001/05/18 11:04:23 $
  + * @version CVS $Revision: 1.3 $ $Date: 2001/05/31 10:54:14 $
    */
   public abstract class AbstractSitemap extends AbstractLoggable implements Sitemap, 
Disposable, ThreadSafe {
       private Context context;
  @@ -262,14 +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
        */
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to