This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch 1.X in repository https://gitbox.apache.org/repos/asf/commons-beanutils.git
commit 8f38a79627e7a9d0370a3365b18e9613570c8b0f Author: Gary Gregory <[email protected]> AuthorDate: Wed Jul 24 08:41:06 2024 -0400 Use compact array declaration - Remove redundant call to super() - Remove redundant parens - No need to nest --- .../beanutils/BeanPropertyValueEqualsPredicate.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java b/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java index 68f63859..ed2f5950 100644 --- a/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java +++ b/src/main/java/org/apache/commons/beanutils/BeanPropertyValueEqualsPredicate.java @@ -162,15 +162,12 @@ public class BeanPropertyValueEqualsPredicate implements Predicate { * @throws IllegalArgumentException If the property name provided is null or empty. */ public BeanPropertyValueEqualsPredicate(final String propertyName, final Object propertyValue, final boolean ignoreNull) { - super(); - - if ((propertyName != null) && (propertyName.length() > 0)) { - this.propertyName = propertyName; - this.propertyValue = propertyValue; - this.ignoreNull = ignoreNull; - } else { + if (propertyName == null || propertyName.length() <= 0) { throw new IllegalArgumentException("propertyName cannot be null or empty"); } + this.propertyName = propertyName; + this.propertyValue = propertyValue; + this.ignoreNull = ignoreNull; } /** @@ -191,6 +188,7 @@ public class BeanPropertyValueEqualsPredicate implements Predicate { * provided. Or if an object in the property path provided is <code>null</code> and * <code>ignoreNull</code> is set to <code>false</code>. */ + @Override public boolean evaluate(final Object object) { boolean evaluation = false; @@ -201,15 +199,14 @@ public class BeanPropertyValueEqualsPredicate implements Predicate { } catch (final IllegalArgumentException e) { final String errorMsg = "Problem during evaluation. Null value encountered in property path..."; - if (ignoreNull) { - log.warn("WARNING: " + errorMsg + e); - } else { + if (!ignoreNull) { final IllegalArgumentException iae = new IllegalArgumentException(errorMsg); if (!BeanUtils.initCause(iae, e)) { log.error(errorMsg, e); } throw iae; } + log.warn("WARNING: " + errorMsg + e); } catch (final IllegalAccessException e) { final String errorMsg = "Unable to access the property provided."; final IllegalArgumentException iae = new IllegalArgumentException(errorMsg); @@ -245,7 +242,7 @@ public class BeanPropertyValueEqualsPredicate implements Predicate { * @return True if they are equal; false otherwise. */ protected boolean evaluateValue(final Object expected, final Object actual) { - return (expected == actual) || ((expected != null) && expected.equals(actual)); + return expected == actual || expected != null && expected.equals(actual); } /**
