diff options
author | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-07-05 13:37:07 +0300 |
---|---|---|
committer | Teemu Suo-Anttila <teemusa@vaadin.com> | 2016-07-06 10:23:33 +0300 |
commit | 9bb15290835800f5cf64ba536aaedf7ea35dd0ca (patch) | |
tree | 49cd48dc105fc0d36b9e58cb0fa816bac27b662e /server/src/main/java/com/vaadin/navigator | |
parent | 5cdc0c1bb2c02864065f63173a2918e9d9015de4 (diff) | |
download | vaadin-framework-9bb15290835800f5cf64ba536aaedf7ea35dd0ca.tar.gz vaadin-framework-9bb15290835800f5cf64ba536aaedf7ea35dd0ca.zip |
Fix navigation to same view with different parameters (#20029)
Change-Id: I0ecc18f0ee5aecac42cfc6c9422932e2e308ab83
Diffstat (limited to 'server/src/main/java/com/vaadin/navigator')
-rw-r--r-- | server/src/main/java/com/vaadin/navigator/Navigator.java | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/server/src/main/java/com/vaadin/navigator/Navigator.java b/server/src/main/java/com/vaadin/navigator/Navigator.java index 390e252906..9aa3bc468c 100644 --- a/server/src/main/java/com/vaadin/navigator/Navigator.java +++ b/server/src/main/java/com/vaadin/navigator/Navigator.java @@ -558,27 +558,30 @@ public class Navigator implements Serializable { longestViewName = errorProvider.getViewName(navigationState); viewWithLongestName = errorProvider.getView(longestViewName); } - if (viewWithLongestName != null) { - String parameters = ""; - if (navigationState.length() > longestViewName.length() + 1) { - parameters = navigationState - .substring(longestViewName.length() + 1); - } - if (getCurrentView() == null - || !SharedUtil - .equals(getCurrentView(), viewWithLongestName)) { - navigateTo(viewWithLongestName, longestViewName, parameters); - } else { - updateNavigationState(new ViewChangeEvent(this, - getCurrentView(), viewWithLongestName, longestViewName, - parameters)); - } - } else { + + if (viewWithLongestName == null) { throw new IllegalArgumentException( "Trying to navigate to an unknown state '" + navigationState + "' and an error view provider not present"); } + + String parameters = ""; + if (navigationState.length() > longestViewName.length() + 1) { + parameters = navigationState + .substring(longestViewName.length() + 1); + } else if (navigationState.endsWith("/")) { + navigationState = navigationState.substring(0, + navigationState.length() - 1); + } + if (getCurrentView() == null + || !SharedUtil.equals(getCurrentView(), viewWithLongestName) + || !SharedUtil.equals(currentNavigationState, navigationState)) { + navigateTo(viewWithLongestName, longestViewName, parameters); + } else { + updateNavigationState(new ViewChangeEvent(this, getCurrentView(), + viewWithLongestName, longestViewName, parameters)); + } } /** @@ -677,8 +680,8 @@ public class Navigator implements Serializable { } if (!navigationState.equals(getStateManager().getState())) { getStateManager().setState(navigationState); - currentNavigationState = navigationState; } + currentNavigationState = navigationState; } } |