You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org> on 2008/07/03 06:22:45 UTC

[jira] Created: (MYFACES-1888) catch Throwable errors when using ErrorPageWriter (myfaces error handling)

catch Throwable errors when using ErrorPageWriter (myfaces error handling)
--------------------------------------------------------------------------

                 Key: MYFACES-1888
                 URL: https://issues.apache.org/jira/browse/MYFACES-1888
             Project: MyFaces Core
          Issue Type: Improvement
    Affects Versions: 1.2.3,  1.1.6-SNAPSHOT
            Reporter: Leonardo Uribe
            Assignee: Leonardo Uribe


One possible enhancement to the myfaces error handling capability is catch Throwable errors when using myfaces error handling.

This should be done taking into account what the spec says about it:

- Call the execute() method of the saved Lifecycle instance, passing the
FacesContext instance for this request as a parameter. If the execute()
method throws a FacesException, re-throw it as a ServletException with
the FacesException as the root cause.
 Call the render() method of the saved Lifecycle instance, passing the
FacesContext instance for this request as a parameter. If the render() method
throws a FacesException, re-throw

The idea is catch and rethrow non Exception classes like errors (extends from Throwable or Error classes directly). If Myfaces error handling is used use it to show the error page with the info, taking into account that not all info could be available.

The idea is do this on FacesServlet:

        try {
			_lifecycle.execute(facesContext);

            if (!handleQueuedExceptions(facesContext))
            {
                _lifecycle.render(facesContext);
            }
		}
        catch (Exception e)
        {
            handleLifecycleException(facesContext, e);
        }
        catch (Throwable e)
        {
            //Handle Error and Throwable error cases (out-of-memory-errors, ....).
            handleLifecycleThrowable(facesContext, e);
        }    
        finally
        {
            facesContext.release();
        }

Please note that any change should not break old functionality.

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


[jira] Commented: (MYFACES-1888) catch Throwable errors when using ErrorPageWriter (myfaces error handling)

Posted by "Leonardo Uribe (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-1888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12610346#action_12610346 ] 

Leonardo Uribe commented on MYFACES-1888:
-----------------------------------------

After reproducing many error situations several conclusions where found:

1. All Throwable error events are encapsulated in a Exception when occur in code called by EL expressions. So the actual code works fine for this cases.
2. Throwable error events inside custom validators, renderers, converters, phaseListeners (without EL calls) are not catched by the actual code (the behavior we want to correct).
3. Simulating StackOverflowError and OutOfMemoryError, catching works well but on OutOfMemoryError sometimes the stack trace could not be rendered (because no mem available!).

I'll commit a solution for both branches (1.1 and 1.2) soon

> catch Throwable errors when using ErrorPageWriter (myfaces error handling)
> --------------------------------------------------------------------------
>
>                 Key: MYFACES-1888
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1888
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions:  1.1.6-SNAPSHOT, 1.2.3
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>
> One possible enhancement to the myfaces error handling capability is catch Throwable errors when using myfaces error handling.
> This should be done taking into account what the spec says about it:
> - Call the execute() method of the saved Lifecycle instance, passing the
> FacesContext instance for this request as a parameter. If the execute()
> method throws a FacesException, re-throw it as a ServletException with
> the FacesException as the root cause.
>  Call the render() method of the saved Lifecycle instance, passing the
> FacesContext instance for this request as a parameter. If the render() method
> throws a FacesException, re-throw
> The idea is catch and rethrow non Exception classes like errors (extends from Throwable or Error classes directly). If Myfaces error handling is used use it to show the error page with the info, taking into account that not all info could be available.
> The idea is do this on FacesServlet:
>         try {
> 			_lifecycle.execute(facesContext);
>             if (!handleQueuedExceptions(facesContext))
>             {
>                 _lifecycle.render(facesContext);
>             }
> 		}
>         catch (Exception e)
>         {
>             handleLifecycleException(facesContext, e);
>         }
>         catch (Throwable e)
>         {
>             //Handle Error and Throwable error cases (out-of-memory-errors, ....).
>             handleLifecycleThrowable(facesContext, e);
>         }    
>         finally
>         {
>             facesContext.release();
>         }
> Please note that any change should not break old functionality.

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


[jira] Updated: (MYFACES-1888) catch Throwable errors when using ErrorPageWriter (myfaces error handling)

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

Leonardo Uribe updated MYFACES-1888:
------------------------------------

    Status: Patch Available  (was: Open)

> catch Throwable errors when using ErrorPageWriter (myfaces error handling)
> --------------------------------------------------------------------------
>
>                 Key: MYFACES-1888
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1888
>             Project: MyFaces Core
>          Issue Type: Improvement
>    Affects Versions:  1.1.6-SNAPSHOT, 1.2.3
>            Reporter: Leonardo Uribe
>            Assignee: Leonardo Uribe
>         Attachments: patchHandleErrorListUpdatePhase11.patch
>
>
> One possible enhancement to the myfaces error handling capability is catch Throwable errors when using myfaces error handling.
> This should be done taking into account what the spec says about it:
> - Call the execute() method of the saved Lifecycle instance, passing the
> FacesContext instance for this request as a parameter. If the execute()
> method throws a FacesException, re-throw it as a ServletException with
> the FacesException as the root cause.
>  Call the render() method of the saved Lifecycle instance, passing the
> FacesContext instance for this request as a parameter. If the render() method
> throws a FacesException, re-throw
> The idea is catch and rethrow non Exception classes like errors (extends from Throwable or Error classes directly). If Myfaces error handling is used use it to show the error page with the info, taking into account that not all info could be available.
> The idea is do this on FacesServlet:
>         try {
> 			_lifecycle.execute(facesContext);
>             if (!handleQueuedExceptions(facesContext))
>             {
>                 _lifecycle.render(facesContext);
>             }
> 		}
>         catch (Exception e)
>         {
>             handleLifecycleException(facesContext, e);
>         }
>         catch (Throwable e)
>         {
>             //Handle Error and Throwable error cases (out-of-memory-errors, ....).
>             handleLifecycleThrowable(facesContext, e);
>         }    
>         finally
>         {
>             facesContext.release();
>         }
> Please note that any change should not break old functionality.

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