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 80fcd57ddcbdb92a32028cf807e0ee79610b8c6d Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Aug 31 08:52:22 2024 -0400 Javadoc --- .../commons/beanutils2/PropertyUtilsBean.java | 27 ++++++++-------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java index 00c4a75e..84b0586f 100644 --- a/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java +++ b/src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java @@ -1202,14 +1202,12 @@ public class PropertyUtilsBean { return MethodUtils.getAccessibleMethod(descriptor.getWriteMethod()); } - /** This just catches and wraps IllegalArgumentException. */ - private Object invokeMethod( - final Method method, - final Object bean, - final Object[] values) - throws - IllegalAccessException, - InvocationTargetException { + /** + * Delegates to {@link Method#invoke(Object, Object...)} and handles some unchecked exceptions. + * + * @see Method#invoke(Object, Object...) + */ + private Object invokeMethod(final Method method, final Object bean, final Object[] values) throws IllegalAccessException, InvocationTargetException { Objects.requireNonNull(bean, "bean"); try { return method.invoke(bean, values); @@ -1239,15 +1237,10 @@ public class PropertyUtilsBean { expectedString.append(parTypes[i].getName()); } } - final IllegalArgumentException e = new IllegalArgumentException( - "Cannot invoke " + method.getDeclaringClass().getName() + "." - + method.getName() + " on bean class '" + bean.getClass() + - "' - " + cause.getMessage() - // as per https://issues.apache.org/jira/browse/BEANUTILS-224 - + " - had objects of type \"" + valueString - + "\" but expected signature \"" - + expectedString + "\"" - ); + final IllegalArgumentException e = new IllegalArgumentException("Cannot invoke " + method.getDeclaringClass().getName() + "." + method.getName() + + " on bean class '" + bean.getClass() + "' - " + cause.getMessage() + // as per https://issues.apache.org/jira/browse/BEANUTILS-224 + + " - had objects of type \"" + valueString + "\" but expected signature \"" + expectedString + "\""); if (!BeanUtils.initCause(e, cause)) { LOG.error("Method invocation failed", cause); }