Cannot use custom error handler (param org.apache.myfaces.ERROR_HANDLER) due to 
bug in FacesServlet
---------------------------------------------------------------------------------------------------

                 Key: MYFACES-2214
                 URL: https://issues.apache.org/jira/browse/MYFACES-2214
             Project: MyFaces Core
          Issue Type: Bug
          Components: JSR-252
    Affects Versions: 1.2.6, 1.2.5, 1.2.4, 1.2.3, 1.2.2
         Environment: JRE 1.6.11, Tomcat 6.0.18, myfaces-1.2.6
            Reporter: Dirk Möbius


With MYFACES-1685 the possiblity to set a custom error handler has been 
introduced with the following init parameters:

  org.apache.myfaces.ERROR_HANDLING = true (default)
  org.apache.myfaces.ERROR_HANDLER = <class name>

Alas, the current implementation of FacesServlet has a small but fatal bug, 
which makes using a custom error handler completely unusable:

In the private method handleQueuedExceptions(FacesContext) in lines 203-204 it 
says:

  Method m = clazz.getMethod("handleExceptionList", new 
Class[]{FacesContext.class,Exception.class});
  m.invoke(errorHandler, new Object[]{facesContext, li});

This code finds a method with signature 
handleExceptionList(FacesContext,Exception), but invokes it with 
(FacesContext,List) parameter instances. This leads to an exception: 
IllegalArgumentException: argument type mismatch

The correct code would be:

  Method m = clazz.getMethod("handleExceptionList", new 
Class[]{FacesContext.class,List.class});
  m.invoke(errorHandler, new Object[]{facesContext, li});

Because of this bug it is impossible to create a custom error handler for 
exceptions collected in the update model phase. I am unable to see a workaround.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to