Details
Description
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[]
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.
Attachments
Issue Links
- is related to
-
MYFACES-1685 Enabled exception handling like in Facelets for the rest of the MyFaces LifeCycle
- Closed