[PATCH] Server side validation for flys/issue1549

Wald Commits scm-commit at wald.intevation.org
Thu Jan 23 17:49:00 CET 2014


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1390495735 -3600
# Node ID 714fda61b006f16b65729c8ad36fc8c58c05b238
# Parent  46273d890da580d7058771b2cfb84a200a1abe56
Server side validation for flys/issue1549.

diff -r 46273d890da5 -r 714fda61b006 artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelGroundDifferences.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelGroundDifferences.java	Wed Jan 22 13:26:35 2014 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/WaterlevelGroundDifferences.java	Thu Jan 23 17:48:55 2014 +0100
@@ -161,5 +161,18 @@
             throw new IllegalArgumentException("error_invalid_double_value");
         }
     }
+
+    @Override
+    protected boolean validateBounds(
+        double fromValid, double toValid,
+        double from,      double to
+    ) throws IllegalArgumentException {
+        if (to < 0d) {
+            logger.error(
+                "Invalid 'to' " + to + " is lesser than zero.");
+            throw new IllegalArgumentException("error_feed_from_out_of_range");
+        }
+        return super.validateBounds(fromValid, toValid, from, to);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :


More information about the Dive4elements-commits mailing list