diff gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java @ 104:5e086156e3d1

Bugfix: Remove leading- and trailingwhitespaces from Date- and Integervalues gnv-artifacts/trunk@153 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 29 Sep 2009 12:03:39 +0000
parents e01c163ea5b0
children 065ec0a29394
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java	Tue Sep 29 12:01:41 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/utils/InputValidator.java	Tue Sep 29 12:03:39 2009 +0000
@@ -31,11 +31,11 @@
         for (int i = 0; i < values.length; i++){
             boolean valid;
             if ("Integer".equalsIgnoreCase(type)){
-                valid = org.apache.commons.validator.GenericValidator.isInt(values[i]);
+                valid = org.apache.commons.validator.GenericValidator.isInt(values[i].trim());
             }else if ("String".equalsIgnoreCase(type)){
                 valid = org.apache.commons.validator.GenericValidator.matchRegexp(values[i], "[a-zA-Z0-9]");
             }else if ("Date".equalsIgnoreCase(type)){
-                valid = org.apache.commons.validator.GenericValidator.isDate(values[i], DateUtils.DATE_PATTERN, true);
+                valid = org.apache.commons.validator.GenericValidator.isDate(values[i].trim(), DateUtils.DATE_PATTERN, true);
             }else{
                 valid = false;
             }

http://dive4elements.wald.intevation.org