Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-2214

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.2.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6
    • 1.2.7
    • JSR-252
    • None
    • JRE 1.6.11, Tomcat 6.0.18, myfaces-1.2.6

    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[]

      {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.

      Attachments

        Issue Links

          Activity

            People

              lu4242 Leonardo Uribe
              dirkmoebius Dirk Möbius
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: