This is an automated email from the ASF dual-hosted git repository.

garydgregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-validator.git


The following commit(s) were added to refs/heads/master by this push:
     new da365e88 Don't use double negation.
da365e88 is described below

commit da365e881244bd85a1ca97c739b56c1b18ecfba4
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jun 13 13:28:36 2026 +0000

    Don't use double negation.
    
    Inline single use local variable
---
 .../apache/commons/validator/routines/AbstractNumberValidator.java  | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
 
b/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
index 90a76626..0af0c5dc 100644
--- 
a/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
+++ 
b/src/main/java/org/apache/commons/validator/routines/AbstractNumberValidator.java
@@ -155,14 +155,12 @@ public abstract class AbstractNumberValidator extends 
AbstractFormatValidator {
     @Override
     protected Format getFormat(final String pattern, final Locale locale) {
         final NumberFormat formatter;
-        final boolean usePattern = !GenericValidator.isBlankOrNull(pattern);
-        if (!usePattern) {
+        if (GenericValidator.isBlankOrNull(pattern)) {
             formatter = (NumberFormat) getFormat(locale);
         } else if (locale == null) {
             formatter = new DecimalFormat(pattern);
         } else {
-            final DecimalFormatSymbols symbols = new 
DecimalFormatSymbols(locale);
-            formatter = new DecimalFormat(pattern, symbols);
+            formatter = new DecimalFormat(pattern, new 
DecimalFormatSymbols(locale));
         }
         if (!isAllowFractions()) {
             formatter.setParseIntegerOnly(true);

Reply via email to