ref #9038 slightly adapted the regEx for StatisticalMeasurementValue BigDecimal
authorAndreas Müller <a.mueller@bgbm.org>
Fri, 12 Jun 2020 15:08:51 +0000 (17:08 +0200)
committerAndreas Müller <a.mueller@bgbm.org>
Fri, 12 Jun 2020 15:08:51 +0000 (17:08 +0200)
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/BigDecimalWithLabelElement.java

index 022955a498cf046c3476d0f75e3761f7e861e225..6872d64a76979c13adbe410fead7fb363763a983 100755 (executable)
@@ -40,7 +40,7 @@ public class BigDecimalWithLabelElement extends NumberWithLabelElement {
         }
 
         try{
-            String pattern = "-?\\d*.?\\d{0,10}";
+            String pattern = "-?\\d{0,9}.?\\d{0,9})";
             if (value.matches(pattern)){
                 BigDecimal number = new BigDecimal(value);
                 if((start != null && number.compareTo(start) < 0 || (end != null && number.compareTo(end) > 0))){
@@ -80,8 +80,11 @@ public class BigDecimalWithLabelElement extends NumberWithLabelElement {
 
     public BigDecimal getBigDecimal(){
         String text = super.getText();
+        if (StringUtils.isBlank(text) || "-".equals(text)){
+            return null;
+        }
         try {
-            return StringUtils.isBlank(text) ? null : new BigDecimal(text);
+            return new BigDecimal(text);
         } catch (NumberFormatException e) {
             exception = e;
             return null;