MyFaces Core
  1. MyFaces Core
  2. MYFACES-1848

JSP regular exceptions causes vlack page output

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2.2
    • Fix Version/s: 1.2.4
    • Component/s: None
    • Labels:
      None

      Description

      The new JSF (1.2.2) outputs a nice formatted exception message (with session variables, view and full stacktrace).
      But when I get error in the page caused by JSP, I simply see a blank page (I am able to see the exception itself in the console ...)

        Activity

        Transition Time In Source Status Execution Times Last Executer Last Execution Date
        Open Open Closed Closed
        126d 4h 52m 1 Leonardo Uribe 07/Aug/08 20:42
        Leonardo Uribe made changes -
        Fix Version/s 1.2.4 [ 12313378 ]
        Fix Version/s 1.2.4-SNAPSHOT [ 12313145 ]
        Leonardo Uribe made changes -
        Status Open [ 1 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Fix Version/s 1.2.4-SNAPSHOT [ 12313145 ]
        Hide
        Leonardo Uribe added a comment -

        After several days trying to solve this issue, some conclusions arise:

        1. This problem is not present on myfaces core 1.1.6-SNAPSHOT.

        so

        2. There was some change between 1.1 and 1.2 related to this issue, rather than a bug on myfaces error handling capability

        Finally the solution is on method buildView of class JspViewHandlerImpl. This method wraps the response and this is when the problem begins. When a call to dispatch fails (jsp error) the response is not restored, so all error output goes to the wrapped response instead the real response (what we want).

        The solution is do something like this:

        private boolean buildView(ServletResponse response, ExternalContext externalContext, String viewId) throws IOException {
        ViewResponseWrapper wrappedResponse = new ViewResponseWrapper((HttpServletResponse) response);

        externalContext.setResponse(wrappedResponse);
        try

        { externalContext.dispatch(viewId); }

        finally

        { externalContext.setResponse(response); }

        /...............more code............/

        So if an jsp error occurs the response is restored and the blank page is replaced by the error page. This change has no effect on the old behavior of JspViewHandlerImpl.

        Show
        Leonardo Uribe added a comment - After several days trying to solve this issue, some conclusions arise: 1. This problem is not present on myfaces core 1.1.6-SNAPSHOT. so 2. There was some change between 1.1 and 1.2 related to this issue, rather than a bug on myfaces error handling capability Finally the solution is on method buildView of class JspViewHandlerImpl. This method wraps the response and this is when the problem begins. When a call to dispatch fails (jsp error) the response is not restored, so all error output goes to the wrapped response instead the real response (what we want). The solution is do something like this: private boolean buildView(ServletResponse response, ExternalContext externalContext, String viewId) throws IOException { ViewResponseWrapper wrappedResponse = new ViewResponseWrapper((HttpServletResponse) response); externalContext.setResponse(wrappedResponse); try { externalContext.dispatch(viewId); } finally { externalContext.setResponse(response); } / ...............more code............ / So if an jsp error occurs the response is restored and the blank page is replaced by the error page. This change has no effect on the old behavior of JspViewHandlerImpl.
        Leonardo Uribe made changes -
        Field Original Value New Value
        Assignee Leonardo Uribe [ lu4242 ]
        Hide
        Guy Bashan added a comment -

        This bug is pretty annoying and can be simulated very easily:
        Generate a regular jsp page that throws exception.
        Run the page regularly (not through faces) and you will see the exception on the screen.
        Run the page through faces and you will get a blank page.

        Show
        Guy Bashan added a comment - This bug is pretty annoying and can be simulated very easily: Generate a regular jsp page that throws exception. Run the page regularly (not through faces) and you will see the exception on the screen. Run the page through faces and you will get a blank page.
        Guy Bashan created issue -

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Guy Bashan
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development