diff flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java @ 1490:15b4bc8eede0

#302 Improved input validation in WQ panels. flys-client/trunk@3576 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 03 Jan 2012 13:27:14 +0000
parents f98bd9b5cedd
children 360e22afb98b
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java	Tue Jan 03 09:47:36 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/client/ui/DoubleRangePanel.java	Tue Jan 03 13:27:14 2012 +0000
@@ -148,10 +148,15 @@
 
 
     public boolean validateForm() {
-        return
-            validateForm(fromItem) &&
-            validateForm(toItem) &&
-            validateForm(stepItem);
+        try {
+            return
+                validateForm(fromItem) &&
+                validateForm(toItem) &&
+                validateForm(stepItem);
+        }
+        catch (NumberFormatException nfe) {
+            return false;
+        }
     }
 
     /**
@@ -215,7 +220,7 @@
      *
      * @return the start value.
      */
-    public double getFrom() {
+    public double getFrom() throws NullPointerException {
         String v = getValueAsString(FIELD_FROM);
 
         return getDouble(v);
@@ -227,7 +232,7 @@
      *
      * @return the end value.
      */
-    public double getTo() {
+    public double getTo() throws NullPointerException {
         String v = getValueAsString(FIELD_TO);
 
         return getDouble(v);
@@ -239,7 +244,7 @@
      *
      * @return the step width.
      */
-    public double getStep() {
+    public double getStep() throws NullPointerException {
         String v = getValueAsString(FIELD_WIDTH);
 
         return getDouble(v);

http://dive4elements.wald.intevation.org