summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenri Sara <hesara@vaadin.com>2012-10-29 13:56:58 +0000
committerVaadin Code Review <review@vaadin.com>2012-10-29 13:56:58 +0000
commit4633d4a79a1f7d39d1e1cdb88ed3fb771b285861 (patch)
treeddf5c3f9456262aa051f0313113980c2a65e4798
parent274565fa24b7b04e99b7dec621005d93801f7fbb (diff)
parentc79413ae4d2c5797bb90c50ddc1442f2e7ea1004 (diff)
downloadvaadin-framework-4633d4a79a1f7d39d1e1cdb88ed3fb771b285861.tar.gz
vaadin-framework-4633d4a79a1f7d39d1e1cdb88ed3fb771b285861.zip
Merge "Fix potential NPE in Page.setFragment (#10089)"
-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) {