DESCRIPTION HERE JAVASERVERFACES-3695, 3694, 3574 1. fix #3694 by add the following line in method findSwitchMatch, which set newFlow to null if the last node is return Node so that facesContext.application.flowHandler.currentFlow is null when the flow return to outside. + if (null != result) { + result.currentFlow = currentFlow; + if (result.newFlow == FlowImpl.SYNTHESIZED_RETURN_CASE_FLOW) { + result.newFlow = null; + } else { + result.newFlow = currentFlow; + } + } 2. fix #3574 and #3695 by changing the following lines in method findReturnMatch, so the newFlow will not be null when the next node is Flow Call Node, so avoid the NPE. - if (null != result) { + + if (null != result && result.facesFlowCallNode == null ) { result.currentFlow = currentFlow; result.newFlow = null; } 3. uncomment the related tests which were commented out in #3593. SECTION: Modified Files ---------------------------- M jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java M test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/ReturnNaviToOtherNodesIT.java M test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/SwitchNaviToOtherNodesIT.java SECTION: Diffs ---------------------------- Index: jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java =================================================================== --- jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java (revision 14265) +++ jsf-ri/src/main/java/com/sun/faces/application/NavigationHandlerImpl.java (working copy) @@ -974,6 +974,14 @@ } } + if (null != result) { + result.currentFlow = currentFlow; + if (result.newFlow == FlowImpl.SYNTHESIZED_RETURN_CASE_FLOW) { + result.newFlow = null; + } else { + result.newFlow = currentFlow; + } + } return result; } @@ -1287,7 +1295,6 @@ null, false, false); - } } } @@ -1297,7 +1304,8 @@ } } } - if (null != result) { + + if (null != result && result.facesFlowCallNode == null ) { result.currentFlow = currentFlow; result.newFlow = null; } Index: test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/ReturnNaviToOtherNodesIT.java =================================================================== --- test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/ReturnNaviToOtherNodesIT.java (revision 14265) +++ test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/ReturnNaviToOtherNodesIT.java (working copy) @@ -122,18 +122,17 @@ assertTrue(page.asXml().contains("flowScope value, should be empty: .")); } -// comment out this to make hudson clean, will uncomment once the issue fixed. -// @Test -// public void testReturnNaviToFlowCallNode() throws Exception { -// HtmlPage page = webClient.getPage(webUrl); -// HtmlSubmitInput button = (HtmlSubmitInput) page.getHtmlElementById("go_to_start_from_return_flow"); -// page = button.click(); -// button = (HtmlSubmitInput) page.getHtmlElementById("go_to_initial_return_node_flow"); -// page = button.click(); -// HtmlTextInput returnNode = (HtmlTextInput)page.getHtmlElementById("parent-node-to-be-returned"); -// returnNode.setValueAttribute("FlowCallNodeToBeCalled"); -// button = (HtmlSubmitInput) page.getHtmlElementById("return-to-method-call-node"); -// page = button.click(); -// assertTrue(page.asXml().contains("Great! You are now in the correct destination view.")); -// } + @Test + public void testReturnNaviToFlowCallNode() throws Exception { + HtmlPage page = webClient.getPage(webUrl); + HtmlSubmitInput button = (HtmlSubmitInput) page.getHtmlElementById("go_to_start_from_return_flow"); + page = button.click(); + button = (HtmlSubmitInput) page.getHtmlElementById("go_to_initial_return_node_flow"); + page = button.click(); + HtmlTextInput returnNode = (HtmlTextInput)page.getHtmlElementById("parent-node-to-be-returned"); + returnNode.setValueAttribute("FlowCallNodeToBeCalled"); + button = (HtmlSubmitInput) page.getHtmlElementById("return-to-method-call-node"); + page = button.click(); + assertTrue(page.asXml().contains("Great! You are now in the correct destination view.")); + } } \ No newline at end of file Index: test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/SwitchNaviToOtherNodesIT.java =================================================================== --- test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/SwitchNaviToOtherNodesIT.java (revision 14265) +++ test/javaee6web/flowTraversalCombinations/src/test/java/com/sun/faces/test/javaee6web/flowtraversalcombinations/SwitchNaviToOtherNodesIT.java (working copy) @@ -100,19 +100,18 @@ assertTrue(page.asXml().contains("Great! You are now in the correct destination view.")); } -// comment out this to make hudson clean, will uncomment once the issue fixed. -// @Test -// public void testSwitchNaviToReturn() throws Exception { -// HtmlPage page = webClient.getPage(webUrl); -// HtmlSubmitInput button = (HtmlSubmitInput) page.getHtmlElementById("go_to_start_from_switch_flow"); -// page = button.click(); -// HtmlRadioButtonInput radio = (HtmlRadioButtonInput) page.getHtmlElementById("select_destination_node:3"); -// page = radio.click(); -// button = (HtmlSubmitInput) page.getHtmlElementById("navigate_to_initial_swtich_node"); -// page = button.click(); -// assertTrue(page.asXml().contains("Has a flow: false.")); -// assertTrue(page.asXml().contains("flowScope value, should be empty: .")); -// } + @Test + public void testSwitchNaviToReturn() throws Exception { + HtmlPage page = webClient.getPage(webUrl); + HtmlSubmitInput button = (HtmlSubmitInput) page.getHtmlElementById("go_to_start_from_switch_flow"); + page = button.click(); + HtmlRadioButtonInput radio = (HtmlRadioButtonInput) page.getHtmlElementById("select_destination_node:3"); + page = radio.click(); + button = (HtmlSubmitInput) page.getHtmlElementById("navigate_to_initial_swtich_node"); + page = button.click(); + assertTrue(page.asXml().contains("Has a flow: false.")); + assertTrue(page.asXml().contains("flowScope value, should be empty: .")); + } @Test public void testSwitchNaviToFlowCall() throws Exception {