aboutsummaryrefslogtreecommitdiffstats
path: root/server
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2012-10-29 15:05:09 +0200
committerJohannes Dahlström <johannesd@vaadin.com>2012-10-29 15:05:09 +0200
commitc79413ae4d2c5797bb90c50ddc1442f2e7ea1004 (patch)
treed12a41f32ee5a9009c9da6d98c2fd2b21cdf6292 /server
parenta67d0e777a6647783eecc64950b698c064d0c029 (diff)
downloadvaadin-framework-c79413ae4d2c5797bb90c50ddc1442f2e7ea1004.tar.gz
vaadin-framework-c79413ae4d2c5797bb90c50ddc1442f2e7ea1004.zip
Fix potential NPE in Page.setFragment (#10089)
Change-Id: I0a0f2981bfd0e3dd26f935e4961b24454103bb30
Diffstat (limited to 'server')
-rw-r--r--server/src/com/vaadin/server/Page.java29
1 files changed, 15 insertions, 14 deletions
diff --git a/server/src/com/vaadin/server/Page.java b/server/src/com/vaadin/server/Page.java
index 510bb4734b..1f4ff040ac 100644
--- a/server/src/com/vaadin/server/Page.java
+++ b/server/src/com/vaadin/server/Page.java
@@ -377,21 +377,22 @@ public class Page implements Serializable {
*/
public void setFragment(String newFragment, boolean fireEvents) {
String oldFragment = location.getFragment();
- if (newFragment == null && oldFragment != null
- || !newFragment.equals(oldFragment)) {
- try {
- location = new URI(location.getScheme(),
- location.getSchemeSpecificPart(), newFragment);
- } catch (URISyntaxException e) {
- // This should not actually happen as the fragment syntax is not
- // constrained
- throw new RuntimeException(e);
- }
- if (fireEvents) {
- fireEvent(new FragmentChangedEvent(this, newFragment));
- }
- uI.markAsDirty();
+ if (newFragment == oldFragment
+ || (newFragment != null && newFragment.equals(oldFragment))) {
+ return;
}
+ try {
+ location = new URI(location.getScheme(),
+ location.getSchemeSpecificPart(), newFragment);
+ } catch (URISyntaxException e) {
+ // This should not actually happen as the fragment syntax is not
+ // constrained
+ throw new RuntimeException(e);
+ }
+ if (fireEvents) {
+ fireEvent(new FragmentChangedEvent(this, newFragment));
+ }
+ uI.markAsDirty();
}
private void fireEvent(EventObject event) {