You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Mike Kienenberger <mk...@gmail.com> on 2012/08/31 21:27:22 UTC

Re: new FacesMessage("No navigation case match for viewId "...

I know I'm late, in this case two years late, in commenting on this
change, but why do we generate a FacesMessage for what's esssentially
a programming error?   Wouldn't it be better to log it instead?  The
developer may not even have a messages component on the page.


On Mon, Sep 13, 2010 at 2:33 PM,  <lu...@apache.org> wrote:
> Author: lu4242
> Date: Mon Sep 13 18:33:23 2010
> New Revision: 996632
>
> URL: http://svn.apache.org/viewvc?rev=996632&view=rev
> Log:
> MYFACES-2897 Render a message if there was no match for outcome (Thanks to Marti Koci for provide this patch)
>
> Modified:
>     myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
>
> Modified: myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java
> URL: http://svn.apache.org/viewvc/myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java?rev=996632&r1=996631&r2=996632&view=diff
> ==============================================================================
> --- myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java (original)
> +++ myfaces/core/trunk/impl/src/main/java/org/apache/myfaces/application/NavigationHandlerImpl.java Mon Sep 13 18:33:23 2010
> @@ -33,7 +33,9 @@ import java.util.logging.Logger;
>
>  import javax.faces.FacesException;
>  import javax.faces.application.ConfigurableNavigationHandler;
> +import javax.faces.application.FacesMessage;
>  import javax.faces.application.NavigationCase;
> +import javax.faces.application.ProjectStage;
>  import javax.faces.application.ViewHandler;
>  import javax.faces.component.UIViewRoot;
>  import javax.faces.context.ExternalContext;
> @@ -202,6 +204,13 @@ public class NavigationHandlerImpl
>              //otherwise, if navgiationCase is still null, check outcome-based nav cases
>              navigationCase = getOutcomeNavigationCase (facesContext, fromAction, outcome);
>          }
> +
> +        if (outcome != null && navigationCase == null && !facesContext.isProjectStage(ProjectStage.Production)) {
> +            final FacesMessage facesMessage = new FacesMessage("No navigation case match for viewId " + viewId +
> +                    ",  action " + fromAction + " and outcome " + outcome);
> +            facesMessage.setSeverity(FacesMessage.SEVERITY_WARN);
> +            facesContext.addMessage(null, facesMessage);
> +        }
>
>          return navigationCase;  //if navigationCase == null, will stay on current view
>
>
>