MyFaces Core
  1. MyFaces Core
  2. MYFACES-3189

NavigationHandler: navigation to nonexistent view after ViewExpired throws NPE

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.8-SNAPSHOT, 2.1.2-SNAPSHOT
    • Fix Version/s: 2.0.8, 2.1.2
    • Component/s: None
    • Labels:
      None

      Description

      see http://weblogs.java.net/blog/edburns/archive/2009/09/03/dealing-gracefully-viewexpiredexception-jsf2

      If user provides nonexistent viewId, NPE occurs: MYFACES-3188

      navigation in this situation leads to facesContext.viewRoot = null. I don't know what spec says about it but mojarra stays on current view in this case (navigate?) - on that view, where VVE is.

      We should also provide a warning about this situation.

        Activity

        Hide
        Martin Kočí added a comment -

        NavigationHandlerImpl.getNavigationCase already provides a info "No navigation case match for viewId ..." but it is not sufficient in this situation because it creates a facesMessage - but there is no view for rendering.

        Show
        Martin Kočí added a comment - NavigationHandlerImpl.getNavigationCase already provides a info "No navigation case match for viewId ..." but it is not sufficient in this situation because it creates a facesMessage - but there is no view for rendering.
        Hide
        Martin Kočí added a comment -

        Steps to reproduce:
        1) provide own exception handler: http://weblogs.java.net/blog/edburns/archive/2009/09/03/dealing-gracefully-viewexpiredexception-jsf2
        2) ExceptionHandler snippet:

        if (t instanceof ViewExpiredException) {
        NavigationHandler nav = facesContext.getApplication().getNavigationHandler();
        try

        { nav.handleNavigation(facesContext, null, "/NonExistentViewExpired.xhtml"); facesContext.renderResponse(); }

        finally

        { i.remove(); }

        }

        3) deploy; simulate ViewExpiredException, for example modify ViewState value in DOM with firebug and submit view
        4) NPE appears: java.lang.NullPointerException
        at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:60)
        at org.apache.myfaces.lifecycle.LifecycleImpl.render

        Environment: myfaces 2.1.2-SNAPSHOT, Tomcat 6.0.26

        To problem is in "/NonExistentViewExpired.xhtml" - if case of VVE, there is no UIViewRoot restored and if NonExistentViewExpired does not exists, there is no UIViewRoot to render.

        Show
        Martin Kočí added a comment - Steps to reproduce: 1) provide own exception handler: http://weblogs.java.net/blog/edburns/archive/2009/09/03/dealing-gracefully-viewexpiredexception-jsf2 2) ExceptionHandler snippet: if (t instanceof ViewExpiredException) { NavigationHandler nav = facesContext.getApplication().getNavigationHandler(); try { nav.handleNavigation(facesContext, null, "/NonExistentViewExpired.xhtml"); facesContext.renderResponse(); } finally { i.remove(); } } 3) deploy; simulate ViewExpiredException, for example modify ViewState value in DOM with firebug and submit view 4) NPE appears: java.lang.NullPointerException at org.apache.myfaces.lifecycle.RenderResponseExecutor.execute(RenderResponseExecutor.java:60) at org.apache.myfaces.lifecycle.LifecycleImpl.render Environment: myfaces 2.1.2-SNAPSHOT, Tomcat 6.0.26 To problem is in "/NonExistentViewExpired.xhtml" - if case of VVE, there is no UIViewRoot restored and if NonExistentViewExpired does not exists, there is no UIViewRoot to render.
        Hide
        Leonardo Uribe added a comment -

        Code commited on MYFACES-3188 to throw ViewNotFoundException, to allow a custom ExceptionHandler implementation to handle it gracefully. Please check it. If no objections I'll close this issue soon too.

        Show
        Leonardo Uribe added a comment - Code commited on MYFACES-3188 to throw ViewNotFoundException, to allow a custom ExceptionHandler implementation to handle it gracefully. Please check it. If no objections I'll close this issue soon too.

          People

          • Assignee:
            Leonardo Uribe
            Reporter:
            Martin Kočí
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development