myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mirko Pasqualini (JIRA)" <...@myfaces.apache.org>
Subject [jira] Commented: (MYFACES-1487) Wildcard navigation rule bug in NavigationHandlerImpl
Date Thu, 10 May 2007 12:17:15 GMT

    [ https://issues.apache.org/jira/browse/MYFACES-1487?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12494722
] 

Mirko Pasqualini commented on MYFACES-1487:
-------------------------------------------

Other bug occurs in the following situation:

<navigation-rule>
  <from-view-id>*</from-view-id>
  <navigation-case>
   <to-view-id>/pageNotFound.jsp</to-view-id>
  </navigation-case>
  <navigation-case>
   <from-outcome>bar</from-outcome>
   <to-view-id>/bar.jsp</to-view-id>
  </navigation-case>
</navigation-rule>

When I request outcome "bar" method calcMatchingNavigationCase return first (right but not
most maching!) case  "/pageNotFound.jsp"  

I'm using a workaround to temporally solve  the problem:

    private NavigationCase calcMatchingNavigationCase(List casesList, String actionRef, String
outcome)
    {
        NavigationCase oneDefaultCase = null;
        for (int i = 0, size = casesList.size(); i < size; i++)
        {
            NavigationCase caze = (NavigationCase)casesList.get(i);
            String cazeOutcome = caze.getFromOutcome();
            String cazeActionRef = caze.getFromAction();
//	http://issues.apache.org/jira/browse/MYFACES-1487
//            if (((cazeOutcome == outcome) || (cazeOutcome != null && cazeOutcome.equals(outcome)))
&&
//                ((cazeActionRef == actionRef) || (cazeActionRef != null && cazeActionRef.equals(actionRef))))
{
//              return caze;
//            }
            
            if ((cazeOutcome == null || cazeOutcome.equals(outcome)) &&
                (cazeActionRef == null || cazeActionRef.equals(actionRef)))
            {
              if (cazeOutcome == null ^ cazeActionRef == null)  
                return caze;
              else
                oneDefaultCase = caze;
            }
        }
        return oneDefaultCase;
    }



> Wildcard navigation rule bug in NavigationHandlerImpl
> -----------------------------------------------------
>
>                 Key: MYFACES-1487
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1487
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 1.1.4
>            Reporter: Jacob Scherrer
>
> A navigation rule bug is present in NavigationHandlerImpl.calcMatchingNavigationCase(..)
> The bug occurs in the following situation:
> given the following navigation rules:
>     <navigation-rule>
>         <from-view-id>/foo.jsp</from-view-id>
>         <navigation-case>
>             <from-outcome>success</from-outcome>
>             <to-view-id>/bar.jsp</to-view-id>
>         </navigation-case>
>     </navigation-rule>
>     <navigation-rule>
>         <navigation-case>
>             <from-action>#{randomBean.newFoobar}</from-action>
>             <from-outcome>success</from-outcome>
>             <to-view-id>/foobar.jsp</to-view-id>
>         </navigation-case>
>     </navigation-rule>
> Also:
> #{randomBean.newFoobar} returns "success"
> If you are in the view /foo.jsp and an action link calling #{randomBean.newFoobar} is
clicked, the first navigation rule will be used. The reason is that the  the rule's actionRef
and the current actionRef are never compared, due to a logic error. This can be fixed by updating
calcMatchingNavigationCase:
> --snip--
>             if (((cazeOutcome == outcome) || (cazeOutcome != null && cazeOutcome.equals(outcome)))
&&
>                 ((cazeActionRef == actionRef) || (cazeActionRef != null && cazeActionRef.equals(actionRef))))
>             {
>                 return caze;
>             }
> --snip--

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


Mime
View raw message