You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Dirk Möbius (JIRA)" <de...@myfaces.apache.org> on 2009/04/23 15:27:30 UTC

[jira] Created: (MYFACES-2214) Cannot use custom error handler (param org.apache.myfaces.ERROR_HANDLER) due to bug in FacesServlet

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.


[jira] Commented: (MYFACES-2214) Cannot use custom error handler (param org.apache.myfaces.ERROR_HANDLER) due to bug in FacesServlet

Posted by "Dirk Möbius (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-2214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12702102#action_12702102 ] 

Dirk Möbius commented on MYFACES-2214:
--------------------------------------

Yes, this works like a charm.

Thanks a lot! That was really fast! :-)


> 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.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6
>         Environment: JRE 1.6.11, Tomcat 6.0.18, myfaces-1.2.6
>            Reporter: Dirk Möbius
>            Assignee: Leonardo Uribe
>             Fix For: 1.2.7-SNAPSHOT
>
>
> 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.


[jira] Resolved: (MYFACES-2214) Cannot use custom error handler (param org.apache.myfaces.ERROR_HANDLER) due to bug in FacesServlet

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-2214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-2214.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.7-SNAPSHOT
         Assignee: Leonardo Uribe

Changed to:

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

as suggested.

> 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.2, 1.2.3, 1.2.4, 1.2.5, 1.2.6
>         Environment: JRE 1.6.11, Tomcat 6.0.18, myfaces-1.2.6
>            Reporter: Dirk Möbius
>            Assignee: Leonardo Uribe
>             Fix For: 1.2.7-SNAPSHOT
>
>
> 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.