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-beanutils.git

commit 5d7d6cbfadb50cfec2c852a2775a469934e0fa47
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Apr 28 08:20:34 2022 -0400

    Extract expression into local variable.
---
 .../org/apache/commons/beanutils2/PropertyUtilsBean.java  | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java 
b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
index a796accd..91403754 100644
--- a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
+++ b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java
@@ -1915,26 +1915,27 @@ public class PropertyUtilsBean {
         if (bean == null) {
             throw new IllegalArgumentException("No bean specified");
         }
+        final Class<?> beanClass = bean.getClass();
         if (name == null) {
             throw new IllegalArgumentException("No name specified for bean 
class '" +
-                    bean.getClass() + "'");
+                    beanClass + "'");
         }
 
         // Validate the syntax of the property name
         if (resolver.hasNested(name)) {
             throw new IllegalArgumentException
                     ("Nested property names are not allowed: Property '" +
-                    name + "' on bean class '" + bean.getClass() + "'");
+                    name + "' on bean class '" + beanClass + "'");
         }
         if (resolver.isIndexed(name)) {
             throw new IllegalArgumentException
                     ("Indexed property names are not allowed: Property '" +
-                    name + "' on bean class '" + bean.getClass() + "'");
+                    name + "' on bean class '" + beanClass + "'");
         }
         if (resolver.isMapped(name)) {
             throw new IllegalArgumentException
                     ("Mapped property names are not allowed: Property '" +
-                    name + "' on bean class '" + bean.getClass() + "'");
+                    name + "' on bean class '" + beanClass + "'");
         }
 
         // Handle DynaBean instances specially
@@ -1955,12 +1956,12 @@ public class PropertyUtilsBean {
                 getPropertyDescriptor(bean, name);
         if (descriptor == null) {
             throw new NoSuchMethodException("Unknown property '" +
-                    name + "' on class '" + bean.getClass() + "'" );
+                    name + "' on class '" + beanClass + "'" );
         }
-        final Method writeMethod = getWriteMethod(bean.getClass(), descriptor);
+        final Method writeMethod = getWriteMethod(beanClass, descriptor);
         if (writeMethod == null) {
             throw new NoSuchMethodException("Property '" + name +
-                    "' has no setter method in class '" + bean.getClass() + 
"'");
+                    "' has no setter method in class '" + beanClass + "'");
         }
 
         // Call the property setter method

Reply via email to