This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-configuration.git
The following commit(s) were added to refs/heads/master by this push:
new 91df915 Use Objects.requireNonNull() instead of custom check. Minor
formatting.
91df915 is described below
commit 91df9155974f841cbf1c235ad2888a9abbc0ee0b
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Dec 25 20:44:04 2019 -0500
Use Objects.requireNonNull() instead of custom check. Minor formatting.
---
.../ImmutableConfigurationInvocationHandler.java | 12 ++++--------
.../configuration2/beanutils/ConfigurationDynaBean.java | 7 ++-----
.../commons/configuration2/beanutils/ConstructorArg.java | 13 ++++++-------
3 files changed, 12 insertions(+), 20 deletions(-)
diff --git
a/src/main/java/org/apache/commons/configuration2/ImmutableConfigurationInvocationHandler.java
b/src/main/java/org/apache/commons/configuration2/ImmutableConfigurationInvocationHandler.java
index fb49d19..4d32438 100644
---
a/src/main/java/org/apache/commons/configuration2/ImmutableConfigurationInvocationHandler.java
+++
b/src/main/java/org/apache/commons/configuration2/ImmutableConfigurationInvocationHandler.java
@@ -20,6 +20,7 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.Iterator;
+import java.util.Objects;
/**
* <p>
@@ -55,17 +56,12 @@ class ImmutableConfigurationInvocationHandler implements
InvocationHandler
* Creates a new instance of {@code
ImmutableConfigurationInvocationHandler}
* and initializes it with the wrapped configuration object.
*
- * @param conf the wrapped {@code Configuration} (must not be <b>null</b>)
+ * @param configuration the wrapped {@code Configuration} (must not be
<b>null</b>)
* @throws NullPointerException if the {@code Configuration} is <b>null</b>
*/
- public ImmutableConfigurationInvocationHandler(final Configuration conf)
+ public ImmutableConfigurationInvocationHandler(final Configuration
configuration)
{
- if (conf == null)
- {
- throw new NullPointerException(
- "Wrapped configuration must not be null!");
- }
- wrappedConfiguration = conf;
+ wrappedConfiguration = Objects.requireNonNull(configuration,
"configuration");
}
/**
diff --git
a/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
b/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
index 6a8075b..dcd1aeb 100644
---
a/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
+++
b/src/main/java/org/apache/commons/configuration2/beanutils/ConfigurationDynaBean.java
@@ -20,6 +20,7 @@ package org.apache.commons.configuration2.beanutils;
import java.lang.reflect.Array;
import java.util.Collection;
import java.util.List;
+import java.util.Objects;
import org.apache.commons.beanutils.DynaBean;
import org.apache.commons.beanutils.DynaClass;
@@ -81,11 +82,7 @@ public class ConfigurationDynaBean extends ConfigurationMap
implements DynaBean
{
LOG.trace("set(" + name + "," + value + ")");
}
-
- if (value == null)
- {
- throw new NullPointerException("Error trying to set property to
null.");
- }
+ Objects.requireNonNull(value, "Error trying to set property to null.");
if (value instanceof Collection)
{
diff --git
a/src/main/java/org/apache/commons/configuration2/beanutils/ConstructorArg.java
b/src/main/java/org/apache/commons/configuration2/beanutils/ConstructorArg.java
index 351795d..c8c86ad 100644
---
a/src/main/java/org/apache/commons/configuration2/beanutils/ConstructorArg.java
+++
b/src/main/java/org/apache/commons/configuration2/beanutils/ConstructorArg.java
@@ -16,6 +16,8 @@
*/
package org.apache.commons.configuration2.beanutils;
+import java.util.Objects;
+
/**
* <p>
* A class representing an argument for a constructor invocation to be used by
a
@@ -81,20 +83,17 @@ public final class ConstructorArg
* is used to match this argument against the parameter type of a
* constructor or the bean class.
*
- * @param decl the {@code BeanDeclaration}
+ * @param beanDeclaration the {@code BeanDeclaration}
* @param typeName the name of the data type of this argument
* @return the newly created instance of this class
* @throws NullPointerException if the {@code BeanDeclaration} is
* <b>null</b>
*/
- public static ConstructorArg forBeanDeclaration(final BeanDeclaration decl,
+ public static ConstructorArg forBeanDeclaration(final BeanDeclaration
beanDeclaration,
final String typeName)
{
- if (decl == null)
- {
- throw new NullPointerException("BeanDeclaration must not be
null!");
- }
- return new ConstructorArg(decl, null, typeName);
+ Objects.requireNonNull(beanDeclaration, "beanDeclaration");
+ return new ConstructorArg(beanDeclaration, null, typeName);
}
/**