Author: pedro
Date: Thu Jan 27 11:30:05 2011
New Revision: 1064091

URL: http://svn.apache.org/viewvc?rev=1064091&view=rev
Log:
merging message improvement on PropertyResolver from trunk
Issue: WICKET-1802

Modified:
    
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
   (contents, props changed)
    
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java
   (contents, props changed)

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java?rev=1064091&r1=1064090&r2=1064091&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
 Thu Jan 27 11:30:05 2011
@@ -71,6 +71,10 @@ public final class PropertyResolver
        /** Log. */
        private static final Logger log = 
LoggerFactory.getLogger(PropertyResolver.class);
 
+       private static final String GET = "get";
+       private static final String IS = "is";
+       private static final String SET = "set";
+
        /**
         * Looks up the value from the object with the given expression. If the 
expression, the object
         * itself or one property evaluates to null then a null will be 
returned.
@@ -93,8 +97,8 @@ public final class PropertyResolver
                {
                        return null;
                }
-               return getter.getValue();
 
+               return getter.getValue();
        }
 
        /**
@@ -113,8 +117,8 @@ public final class PropertyResolver
         * @param converter
         *            The converter to convert the value if needed to the right 
type.
         */
-       public final static void setValue(final String expression, final Object 
object, Object value,
-               PropertyResolverConverter converter)
+       public final static void setValue(final String expression, final Object 
object,
+               final Object value, final PropertyResolverConverter converter)
        {
                if (expression == null || expression.equals(""))
                {
@@ -143,7 +147,7 @@ public final class PropertyResolver
         * @param object
         * @return class of the target property object
         */
-       public final static Class<?> getPropertyClass(String expression, Object 
object)
+       public final static Class<?> getPropertyClass(final String expression, 
final Object object)
        {
                ObjectAndGetSetter setter = getObjectAndGetSetter(expression, 
object, RESOLVE_CLASS);
                if (setter == null)
@@ -160,7 +164,8 @@ public final class PropertyResolver
         * @param clz
         * @return class of the target Class property expression
         */
-       public static <T> Class<T> getPropertyClass(String expression, Class<?> 
clz)
+       @SuppressWarnings("unchecked")
+       public static <T> Class<T> getPropertyClass(final String expression, 
final Class<?> clz)
        {
                ObjectAndGetSetter setter = getObjectAndGetSetter(expression, 
null, RESOLVE_CLASS, clz);
                if (setter == null)
@@ -177,7 +182,7 @@ public final class PropertyResolver
         * @return Field for the property expression or null if such field 
doesn't exist (only getters
         *         and setters)
         */
-       public final static Field getPropertyField(String expression, Object 
object)
+       public final static Field getPropertyField(final String expression, 
final Object object)
        {
                ObjectAndGetSetter setter = getObjectAndGetSetter(expression, 
object, RESOLVE_CLASS);
                if (setter == null)
@@ -194,7 +199,7 @@ public final class PropertyResolver
         * @return Getter method for the property expression or null if such 
getter doesn't exist (only
         *         field)
         */
-       public final static Method getPropertyGetter(String expression, Object 
object)
+       public final static Method getPropertyGetter(final String expression, 
final Object object)
        {
                ObjectAndGetSetter setter = getObjectAndGetSetter(expression, 
object, RESOLVE_CLASS);
                if (setter == null)
@@ -211,7 +216,7 @@ public final class PropertyResolver
         * @return Setter method for the property expression or null if such 
setter doesn't exist (only
         *         field)
         */
-       public final static Method getPropertySetter(String expression, Object 
object)
+       public final static Method getPropertySetter(final String expression, 
final Object object)
        {
                ObjectAndGetSetter setter = getObjectAndGetSetter(expression, 
object, RESOLVE_CLASS);
                if (setter == null)
@@ -237,7 +242,6 @@ public final class PropertyResolver
                return getObjectAndGetSetter(expression, object, 
tryToCreateNull, object.getClass());
        }
 
-
        /**
         * Receives the class parameter also, since this method can resolve the 
type for some
         * expression, only knowing the target class
@@ -249,10 +253,9 @@ public final class PropertyResolver
         * @return {@link ObjectAndGetSetter}
         */
        private static ObjectAndGetSetter getObjectAndGetSetter(final String 
expression,
-               final Object object, int tryToCreateNull, Class<?> clz)
+               final Object object, final int tryToCreateNull, Class<?> clz)
        {
-               final String expressionBracketsSeperated = 
Strings.replaceAll(expression, "[", ".[")
-                       .toString();
+               String expressionBracketsSeperated = 
Strings.replaceAll(expression, "[", ".[").toString();
                int index = getNextDotIndex(expressionBracketsSeperated, 0);
                int lastIndex = 0;
                Object value = object;
@@ -273,7 +276,6 @@ public final class PropertyResolver
                        }
                        catch (WicketRuntimeException ex)
                        {
-
                                // expression by it self can't be found. try to 
find a
                                // setPropertyByIndex(int,value) method
                                index = 
getNextDotIndex(expressionBracketsSeperated, index + 1);
@@ -331,8 +333,13 @@ public final class PropertyResolver
                return new ObjectAndGetSetter(getAndSetter, value);
        }
 
-
-       private static int getNextDotIndex(String expression, int start)
+       /**
+        * 
+        * @param expression
+        * @param start
+        * @return next dot index
+        */
+       private static int getNextDotIndex(final String expression, final int 
start)
        {
                boolean insideBracket = false;
                for (int i = start; i < expression.length(); i++)
@@ -354,7 +361,7 @@ public final class PropertyResolver
                return -1;
        }
 
-       private final static IGetAndSet getGetAndSetter(String exp, Class<?> 
clz)
+       private final static IGetAndSet getGetAndSetter(String exp, final 
Class<?> clz)
        {
                IClassCache classesToGetAndSetters = 
getClassesToGetAndSetters();
                Map<String, IGetAndSet> getAndSetters = 
classesToGetAndSetters.get(clz);
@@ -441,8 +448,8 @@ public final class PropertyResolver
                                                }
                                                else
                                                {
-                                                       throw new 
WicketRuntimeException("can't parse the exp " + exp +
-                                                               " as an index 
for an array lookup");
+                                                       throw new 
WicketRuntimeException("Can't parse the expression '" + exp +
+                                                               "' as an index 
for an array lookup");
                                                }
                                        }
                                }
@@ -461,21 +468,18 @@ public final class PropertyResolver
                                                                String 
propertyIndex = exp.substring(index + 1);
                                                                try
                                                                {
-
                                                                        int 
parsedIndex = Integer.parseInt(propertyIndex);
-                                                                       // if 
so then it could be a
-                                                                       // 
getPropertyIndex(int)
+                                                                       // if 
so then it could be a getPropertyIndex(int)
                                                                        // and 
setPropertyIndex(int, object)
                                                                        String 
name = Character.toUpperCase(propertyName.charAt(0)) +
                                                                                
propertyName.substring(1);
-                                                                       method 
= clz.getMethod("get" + name, new Class[] { int.class });
+                                                                       method 
= clz.getMethod(GET + name, new Class[] { int.class });
                                                                        
getAndSetter = new ArrayPropertyGetSet(method, parsedIndex);
-
                                                                }
                                                                catch 
(Exception e)
                                                                {
                                                                        throw 
new WicketRuntimeException(
-                                                                               
"no get method defined for class: " + clz +
+                                                                               
"No get method defined for class: " + clz +
                                                                                
        " expression: " + propertyName);
                                                                }
                                                        }
@@ -519,7 +523,7 @@ public final class PropertyResolver
         * @param expression
         * @return introspected field
         */
-       private static Field findField(Class<?> clz, String expression)
+       private static Field findField(final Class<?> clz, final String 
expression)
        {
                Field field = null;
                try
@@ -552,13 +556,13 @@ public final class PropertyResolver
         * @param expression
         * @return The method for the expression null if not found
         */
-       private final static Method findGetter(Class<?> clz, String expression)
+       private final static Method findGetter(final Class<?> clz, final String 
expression)
        {
                String name = Character.toUpperCase(expression.charAt(0)) + 
expression.substring(1);
                Method method = null;
                try
                {
-                       method = clz.getMethod("get" + name, (Class[])null);
+                       method = clz.getMethod(GET + name, (Class[])null);
                }
                catch (Exception e)
                {
@@ -567,7 +571,7 @@ public final class PropertyResolver
                {
                        try
                        {
-                               method = clz.getMethod("is" + name, 
(Class[])null);
+                               method = clz.getMethod(IS + name, 
(Class[])null);
                        }
                        catch (Exception e)
                        {
@@ -577,7 +581,7 @@ public final class PropertyResolver
                return method;
        }
 
-       private final static Method findMethod(Class<?> clz, String expression)
+       private final static Method findMethod(final Class<?> clz, String 
expression)
        {
                if (expression.endsWith("()"))
                {
@@ -608,7 +612,6 @@ public final class PropertyResolver
         */
        private final static class ObjectAndGetSetter
        {
-
                private final IGetAndSet getAndSetter;
                private final Object value;
 
@@ -670,10 +673,8 @@ public final class PropertyResolver
                {
                        return getAndSetter.getSetter();
                }
-
        }
 
-
        /**
         * @author jcompagner
         */
@@ -727,7 +728,7 @@ public final class PropertyResolver
        private static abstract class AbstractGetAndSet implements IGetAndSet
        {
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getField()
+                * {@inheritDoc}
                 */
                public Field getField()
                {
@@ -735,7 +736,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getGetter()
+                * {@inheritDoc}
                 */
                public Method getGetter()
                {
@@ -743,7 +744,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getSetter()
+                * {@inheritDoc}
                 */
                public Method getSetter()
                {
@@ -751,7 +752,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getTargetClass()
+                * {@inheritDoc}
                 */
                public Class<?> getTargetClass()
                {
@@ -761,7 +762,7 @@ public final class PropertyResolver
 
        private static final class MapGetSet extends AbstractGetAndSet
        {
-               final private String key;
+               private final String key;
 
                MapGetSet(String key)
                {
@@ -769,27 +770,27 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
-               public Object getValue(Object object)
+               public Object getValue(final Object object)
                {
                        return ((Map<?, ?>)object).get(key);
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#setValue(Object, Object,
-                *      PropertyResolverConverter)
+                * {@inheritDoc}
                 */
                @SuppressWarnings("unchecked")
-               public void setValue(Object object, Object value, 
PropertyResolverConverter converter)
+               public void setValue(final Object object, final Object value,
+                       final PropertyResolverConverter converter)
                {
                        ((Map<String, Object>)object).put(key, value);
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(Object)
+                * {@inheritDoc}
                 */
-               public Object newValue(Object object)
+               public Object newValue(final Object object)
                {
                        // Map can't make a newValue or should it look what is 
more in the
                        // map and try to make one of the class if finds?
@@ -807,21 +808,23 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
-               public Object getValue(Object object)
+               public Object getValue(final Object object)
                {
                        if (((List<?>)object).size() <= index)
+                       {
                                return null;
+                       }
                        return ((List<?>)object).get(index);
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#setValue(Object, Object,
-                *      PropertyResolverConverter)
+                * {@inheritDoc}
                 */
                @SuppressWarnings("unchecked")
-               public void setValue(Object object, Object value, 
PropertyResolverConverter converter)
+               public void setValue(final Object object, final Object value,
+                       final PropertyResolverConverter converter)
                {
                        List<Object> lst = (List<Object>)object;
 
@@ -844,7 +847,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(Object)
+                * {@inheritDoc}
                 */
                public Object newValue(Object object)
                {
@@ -866,7 +869,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
                public Object getValue(Object object)
                {
@@ -878,8 +881,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#setValue(Object, Object,
-                *      PropertyResolverConverter)
+                * {@inheritDoc}
                 */
                public void setValue(Object object, Object value, 
PropertyResolverConverter converter)
                {
@@ -888,7 +890,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(java.lang.Object)
+                * {@inheritDoc}
                 */
                public Object newValue(Object object)
                {
@@ -907,7 +909,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getTargetClass()
+                * {@inheritDoc}
                 */
                @Override
                public Class<?> getTargetClass()
@@ -923,32 +925,33 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
-               public Object getValue(Object object)
+               public Object getValue(final Object object)
                {
                        return new Integer(Array.getLength(object));
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#setValue(Object, Object,
-                *      PropertyResolverConverter)
+                * {@inheritDoc}
                 */
-               public void setValue(Object object, Object value, 
PropertyResolverConverter converter)
+               public void setValue(final Object object, final Object value,
+                       final PropertyResolverConverter converter)
                {
-                       throw new WicketRuntimeException("Cant set the length 
on an array");
+                       throw new WicketRuntimeException("You can't set the 
length on an array:" + object);
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(java.lang.Object)
+                * {@inheritDoc}
                 */
-               public Object newValue(Object object)
+               public Object newValue(final Object object)
                {
-                       throw new WicketRuntimeException("Cant get a new value 
from a length of an array");
+                       throw new WicketRuntimeException("Can't get a new value 
from a length of an array: " +
+                               object);
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getTargetClass()
+                * {@inheritDoc}
                 */
                @Override
                public Class<?> getTargetClass()
@@ -963,30 +966,30 @@ public final class PropertyResolver
                final private Method getMethod;
                private Method setMethod;
 
-               ArrayPropertyGetSet(Method method, int index)
+               ArrayPropertyGetSet(final Method method, final int index)
                {
                        this.index = new Integer(index);
                        getMethod = method;
                        getMethod.setAccessible(true);
                }
 
-               private final static Method findSetter(Method getMethod, 
Class<?> clz)
+               private final static Method findSetter(final Method getMethod, 
final Class<?> clz)
                {
                        String name = getMethod.getName();
-                       name = "set" + name.substring(3);
+                       name = SET + name.substring(3);
                        try
                        {
                                return clz.getMethod(name, new Class[] { 
int.class, getMethod.getReturnType() });
                        }
                        catch (Exception e)
                        {
-                               log.debug("Cannot find setter method 
corresponding to " + getMethod);
+                               log.debug("Can't find setter method 
corresponding to " + getMethod);
                        }
                        return null;
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
                public Object getValue(Object object)
                {
@@ -1009,10 +1012,10 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#setValue(Object, Object,
-                *      PropertyResolverConverter)
+                * {@inheritDoc}
                 */
-               public void setValue(Object object, Object value, 
PropertyResolverConverter converter)
+               public void setValue(final Object object, final Object value,
+                       final PropertyResolverConverter converter)
                {
                        if (setMethod == null)
                        {
@@ -1044,13 +1047,13 @@ public final class PropertyResolver
                        }
                        else
                        {
-                               throw new WicketRuntimeException("no set method 
defined for value: " + value +
+                               throw new WicketRuntimeException("No set method 
defined for value: " + value +
                                        " on object: " + object);
                        }
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getTargetClass()
+                * {@inheritDoc}
                 */
                @Override
                public Class<?> getTargetClass()
@@ -1059,7 +1062,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(java.lang.Object)
+                * {@inheritDoc}
                 */
                public Object newValue(Object object)
                {
@@ -1104,7 +1107,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
                public final Object getValue(final Object object)
                {
@@ -1155,15 +1158,15 @@ public final class PropertyResolver
                                {
                                        if (value != null)
                                        {
-                                               throw new 
ConversionException("Can't convert value: " + value +
-                                                       " to class: " + 
getMethod.getReturnType() + " for setting it on " +
-                                                       object);
+                                               throw new 
ConversionException("Method [" + getMethod +
+                                                       "]. Can't convert 
value: " + value + " to class: " +
+                                                       
getMethod.getReturnType() + " for setting it on " + object);
                                        }
                                        else if 
(getMethod.getReturnType().isPrimitive())
                                        {
-                                               throw new ConversionException(
-                                                       "Can't convert null 
value to a primitive class: " +
-                                                               
getMethod.getReturnType() + " for setting it on " + object);
+                                               throw new 
ConversionException("Method [" + getMethod +
+                                                       "]. Can't convert null 
value to a primitive class: " +
+                                                       
getMethod.getReturnType() + " for setting it on " + object);
                                        }
                                }
                        }
@@ -1208,13 +1211,13 @@ public final class PropertyResolver
                private final static Method findSetter(Method getMethod, 
Class<?> clz)
                {
                        String name = getMethod.getName();
-                       if (name.startsWith("get"))
+                       if (name.startsWith(GET))
                        {
-                               name = "set" + name.substring(3);
+                               name = SET + name.substring(3);
                        }
                        else
                        {
-                               name = "set" + name.substring(2);
+                               name = SET + name.substring(2);
                        }
                        try
                        {
@@ -1252,7 +1255,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(java.lang.Object)
+                * {@inheritDoc}
                 */
                public Object newValue(Object object)
                {
@@ -1277,7 +1280,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getTargetClass()
+                * {@inheritDoc}
                 */
                @Override
                public Class<?> getTargetClass()
@@ -1286,7 +1289,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.AbstractGetAndSet#getGetter()
+                * {@inheritDoc}
                 */
                @Override
                public Method getGetter()
@@ -1295,7 +1298,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.AbstractGetAndSet#getSetter()
+                * {@inheritDoc}
                 */
                @Override
                public Method getSetter()
@@ -1304,7 +1307,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.AbstractGetAndSet#getField()
+                * {@inheritDoc}
                 */
                @Override
                public Field getField()
@@ -1318,7 +1321,6 @@ public final class PropertyResolver
         */
        private static class FieldGetAndSetter extends AbstractGetAndSet
        {
-
                private final Field field;
 
                /**
@@ -1326,7 +1328,7 @@ public final class PropertyResolver
                 * 
                 * @param field
                 */
-               public FieldGetAndSetter(Field field)
+               public FieldGetAndSetter(final Field field)
                {
                        super();
                        this.field = field;
@@ -1334,9 +1336,9 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getValue(java.lang.Object)
+                * {@inheritDoc}
                 */
-               public Object getValue(Object object)
+               public Object getValue(final Object object)
                {
                        try
                        {
@@ -1350,9 +1352,9 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#newValue(java.lang.Object)
+                * {@inheritDoc}
                 */
-               public Object newValue(Object object)
+               public Object newValue(final Object object)
                {
                        Class<?> clz = field.getType();
                        Object value = null;
@@ -1369,10 +1371,10 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#setValue(Object, Object,
-                *      PropertyResolverConverter)
+                * {@inheritDoc}
                 */
-               public void setValue(Object object, Object value, 
PropertyResolverConverter converter)
+               public void setValue(final Object object, Object value,
+                       final PropertyResolverConverter converter)
                {
                        value = converter.convert(value, field.getType());
                        try
@@ -1387,7 +1389,7 @@ public final class PropertyResolver
                }
 
                /**
-                * @see 
org.apache.wicket.util.lang.PropertyResolver.IGetAndSet#getTargetClass()
+                * {@inheritDoc}
                 */
                @Override
                public Class<?> getTargetClass()
@@ -1395,6 +1397,9 @@ public final class PropertyResolver
                        return field.getType();
                }
 
+               /**
+                * {@inheritDoc}
+                */
                @Override
                public Field getField()
                {
@@ -1431,7 +1436,6 @@ public final class PropertyResolver
                applicationToClassesToGetAndSetters.remove(application);
        }
 
-
        /**
         * Sets the {@link IClassCache} for the given application.
         * 
@@ -1444,7 +1448,7 @@ public final class PropertyResolver
         *            to use or null if the default must be set.
         * @param classCache
         */
-       public static void setClassCache(Application application, IClassCache 
classCache)
+       public static void setClassCache(final Application application, final 
IClassCache classCache)
        {
                if (application != null)
                {
@@ -1456,7 +1460,6 @@ public final class PropertyResolver
                }
        }
 
-
        /**
         * An implementation of the class can be set on the
         * {@link PropertyResolver#setClassCacheCreator(Application, 
IClassCache)} method for a specific

Propchange: 
wicket/branches/wicket-1.4.x/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Jan 27 11:30:05 2011
@@ -0,0 +1,4 @@
+/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java:653208,653212,653215,653226,653231,654304,655446,655466,655786,658141,658189,659118,659120,662360,663058,671549,671885,687144-688996,698530-698577,701132-701133,701843,701850-701877,704231,708127,722099-722105,726536,728467-728490,731960,734478,739647,739951,745468-745497,749817,755171-755176,759905,760374,764756,769389,769440,774373,781715,781719,790879
+/wicket/sandbox/jthomerson/experimental/wicket-devutils/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java:760296-760351,760353-760355
+/wicket/trunk/wicket-core/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java:1062291
+/wicket/trunk/wicket-devutils/wicket/src/main/java/org/apache/wicket/util/lang/PropertyResolver.java:760352

Modified: 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java
URL: 
http://svn.apache.org/viewvc/wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java?rev=1064091&r1=1064090&r2=1064091&view=diff
==============================================================================
--- 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java
 (original)
+++ 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java
 Thu Jan 27 11:30:05 2011
@@ -630,4 +630,30 @@ public class PropertyResolverTest extend
                        return String.valueOf(value);
                }
        }
+
+       /**
+        * @see <a 
href="https://issues.apache.org/jira/browse/WICKET-1802";>WICKET-1802</a>
+        */
+       public void 
testConversionExceptionMessageContainsTheObjectPropertyBeingSet()
+       {
+               try
+               {
+                       PropertyResolverConverter convertToNull = new 
PropertyResolverConverter(null, null)
+                       {
+                               private static final long serialVersionUID = 1L;
+
+                               @Override
+                               public Object convert(Object object, Class<?> 
clz)
+                               {
+                                       return null;
+                               }
+                       };
+                       PropertyResolver.setValue("name", person, "", 
convertToNull);
+                       fail("Should have thrown an ConversionException");
+               }
+               catch (ConversionException e)
+               {
+                       
assertTrue(e.getMessage().toLowerCase().contains("name"));
+               }
+       }
 }

Propchange: 
wicket/branches/wicket-1.4.x/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java
------------------------------------------------------------------------------
--- svn:mergeinfo (added)
+++ svn:mergeinfo Thu Jan 27 11:30:05 2011
@@ -0,0 +1,4 @@
+/wicket/branches/wicket-1.3.x/jdk-1.4/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java:653208,653212,653215,653226,653231,654304,655446,655466,655786,658141,658189,659118,659120,662360,663058,671549,671885,687144-688996,698530-698577,701132-701133,701843,701850-701877,704231,708127,722099-722105,726536,728467-728490,731960,734478,739647,739951,745468-745497,749817,755171-755176,759905,760374,764756,769389,769440,774373,781715,781719,790879
+/wicket/sandbox/jthomerson/experimental/wicket-devutils/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java:760296-760351,760353-760355
+/wicket/trunk/wicket-core/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java:1063296
+/wicket/trunk/wicket-devutils/wicket/src/test/java/org/apache/wicket/util/lang/PropertyResolverTest.java:760352


Reply via email to