ref #9038 further improve BigDecimal handling in TaxEditor
authorAndreas Müller <a.mueller@bgbm.org>
Mon, 15 Jun 2020 06:55:53 +0000 (08:55 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Mon, 15 Jun 2020 06:55:53 +0000 (08:55 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/BigDecimalWithLabelElement.java

index 4256241accc6e8efa3121f9fcd67c0c275cefecc..198fbf2a30df7f07179dd4e65507b0097514a18c 100755 (executable)
@@ -40,15 +40,16 @@ public class BigDecimalWithLabelElement extends NumberWithLabelElement {
         }
 
         try{
-            String pattern = "-?\\d{1,9}(.\\d{0,9})?";
+            String pattern = "-?\\d{0,9}(.\\d{0,9})?";
             if (value.matches(pattern)){
                 if ("-".equals(value)){
-                    return;
-                }
-                BigDecimal number = new BigDecimal(value);
-                if((start != null && number.compareTo(start) < 0 || (end != null && number.compareTo(end) > 0))){
-                    exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");
-                    throw exception;
+                    //accept entry
+                }else{
+                    BigDecimal number = new BigDecimal(value);
+                    if((start != null && number.compareTo(start) < 0 || (end != null && number.compareTo(end) > 0))){
+                        exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");
+                        throw exception;
+                    }
                 }
             }else{
                 exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");