You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by mg...@apache.org on 2019/10/10 11:20:35 UTC

[wicket] branch wicket-8.x updated: WICKET-6707 Use only setMethod in PropertyResolver#setValue()

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

mgrigorov pushed a commit to branch wicket-8.x
in repository https://gitbox.apache.org/repos/asf/wicket.git


The following commit(s) were added to refs/heads/wicket-8.x by this push:
     new 15821cf  WICKET-6707 Use only setMethod in PropertyResolver#setValue()
15821cf is described below

commit 15821cf5b62b3fc40611ce5e6717aaaa746505d1
Author: Martin Tzvetanov Grigorov <mg...@apache.org>
AuthorDate: Thu Oct 10 14:19:43 2019 +0300

    WICKET-6707 Use only setMethod in PropertyResolver#setValue()
---
 .../apache/wicket/core/util/lang/PropertyResolver.java | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

diff --git a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
index 17dfe27..7459ee3 100644
--- a/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
+++ b/wicket-core/src/main/java/org/apache/wicket/core/util/lang/PropertyResolver.java
@@ -27,7 +27,6 @@ import java.util.concurrent.ConcurrentHashMap;
 import org.apache.wicket.Application;
 import org.apache.wicket.Session;
 import org.apache.wicket.WicketRuntimeException;
-import org.apache.wicket.core.util.lang.PropertyResolverConverter;
 import org.apache.wicket.util.convert.ConversionException;
 import org.apache.wicket.util.lang.Generics;
 import org.apache.wicket.util.string.Strings;
@@ -961,10 +960,7 @@ public final class PropertyResolver
 			Class<?> type = null;
 			if (setMethod != null)
 			{
-				// getMethod is always there and if the value will be set through a setMethod then
-				// the getMethod return type will be its type. Else we have to look at the
-				// parameters if the setter but getting the return type is quicker
-				type = getMethod.getReturnType();
+				type = setMethod.getParameterTypes()[0];
 			}
 			else if (field != null)
 			{
@@ -981,13 +977,13 @@ public final class PropertyResolver
 					{
 						throw new ConversionException("Method [" + getMethod +
 							"]. Can't convert value: " + value + " to class: " +
-							getMethod.getReturnType() + " for setting it on " + object);
+							type + " for setting it on " + object);
 					}
 					else if (setMethod != null && setMethod.getParameterTypes()[0].isPrimitive())
 					{
-						throw new ConversionException("Method [" + getMethod +
+						throw new ConversionException("Method [" + setMethod +
 							"]. Can't convert null value to a primitive class: " +
-							getMethod.getReturnType() + " for setting it on " + object);
+							type + " for setting it on " + object);
 					}
 				}
 			}
@@ -1292,9 +1288,9 @@ public final class PropertyResolver
 	/**
 	 * A locator of properties.
 	 * 
-	 * @see https://issues.apache.org/jira/browse/WICKET-5623
+	 * @see <a href="https://issues.apache.org/jira/browse/WICKET-5623">WICKET-5623</a>
 	 */
-	public static interface IPropertyLocator
+	public interface IPropertyLocator
 	{
 		/**
 		 * Get {@link IGetAndSet} for a property.
@@ -1582,4 +1578,4 @@ public final class PropertyResolver
 			return method;
 		}
 	}
-}
\ No newline at end of file
+}