changeset 352:ed3325a0232a

Throw an illegal argument exception in LocationDistanceSelect.validate() and WQSelect.validate() if no data has been inserted so far. flys-artifacts/trunk@1759 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 28 Apr 2011 11:08:34 +0000
parents 2d268f9894bb
children 8378683fa07a
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java
diffstat 3 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Thu Apr 28 09:09:44 2011 +0000
+++ b/flys-artifacts/ChangeLog	Thu Apr 28 11:08:34 2011 +0000
@@ -11,6 +11,13 @@
 
 2011-04-28  Ingo Weinzierl <ingo@intevation.de>
 
+	* src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java,
+	  src/main/java/de/intevation/flys/artifacts/states/WQSelect.java:
+	  If no data has been inserted so far, an IllegalArgumentException is
+	  thrown.
+
+2011-04-28  Ingo Weinzierl <ingo@intevation.de>
+
 	* src/main/java/de/intevation/flys/collections/FLYSArtifactCollection.java::
 	  A lot of new methods to retrieve the theme of a facet - used while
 	  creating the output of a facet/artifact. If a facet has no theme yet, it
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java	Thu Apr 28 09:09:44 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/LocationDistanceSelect.java	Thu Apr 28 11:08:34 2011 +0000
@@ -164,6 +164,10 @@
         String toStr   = (String) data.get(TO).getValue();
         String stepStr = (String) data.get(STEP).getValue();
 
+        if (fromStr == null || toStr == null || stepStr == null) {
+            throw new IllegalArgumentException("error_empty_state");
+        }
+
         try {
             double from = Double.parseDouble(fromStr);
             double to   = Double.parseDouble(toStr);
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java	Thu Apr 28 09:09:44 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WQSelect.java	Thu Apr 28 11:08:34 2011 +0000
@@ -203,6 +203,10 @@
         String toStr   = (String) data.get(WQ_TO).getValue();
         String stepStr = (String) data.get(WQ_STEP).getValue();
 
+        if (fromStr == null || toStr == null || stepStr == null) {
+            throw new IllegalArgumentException("error_empty_state");
+        }
+
         double from = Double.parseDouble(fromStr);
         double to   = Double.parseDouble(toStr);
         double step = Double.parseDouble(stepStr);

http://dive4elements.wald.intevation.org