Project

General

Profile

« Previous | Next » 

Revision b627e8ef

Added by Andreas Müller almost 4 years ago

ref #9038 further improve BigDecimal handling in TaxEditor

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/BigDecimalWithLabelElement.java
40 40
        }
41 41

  
42 42
        try{
43
            String pattern = "-?\\d{1,9}(.\\d{0,9})?";
43
            String pattern = "-?\\d{0,9}(.\\d{0,9})?";
44 44
            if (value.matches(pattern)){
45 45
                if ("-".equals(value)){
46
                    return;
47
                }
48
                BigDecimal number = new BigDecimal(value);
49
                if((start != null && number.compareTo(start) < 0 || (end != null && number.compareTo(end) > 0))){
50
                    exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");
51
                    throw exception;
46
                    //accept entry
47
                }else{
48
                    BigDecimal number = new BigDecimal(value);
49
                    if((start != null && number.compareTo(start) < 0 || (end != null && number.compareTo(end) > 0))){
50
                        exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");
51
                        throw exception;
52
                    }
52 53
                }
53 54
            }else{
54 55
                exception = new NumberFormatException("You entered a number that is not within the allowed bounds.");

Also available in: Unified diff