diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java index 8a5272d62c..fda4003b7d 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -355,8 +355,7 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException { try { - String canonicalName = PropertyAccessorUtils.getPropertyName(propertyName); - PropertyDescriptor pd = getPropertyDescriptorInternal(canonicalName); + PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName); if (pd != null) { Class type = getPropertyType(propertyName); if (pd.getReadMethod() != null) { diff --git a/org.springframework.context/src/test/java/org/springframework/format/datetime/joda/JodaTimeFormattingTests.java b/org.springframework.context/src/test/java/org/springframework/format/datetime/joda/JodaTimeFormattingTests.java index 214ec1b708..dd5610d019 100644 --- a/org.springframework.context/src/test/java/org/springframework/format/datetime/joda/JodaTimeFormattingTests.java +++ b/org.springframework.context/src/test/java/org/springframework/format/datetime/joda/JodaTimeFormattingTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,8 +16,10 @@ package org.springframework.format.datetime.joda; +import java.util.ArrayList; import java.util.Calendar; import java.util.Date; +import java.util.List; import java.util.Locale; import org.joda.time.DateTime; @@ -55,7 +57,9 @@ public class JodaTimeFormattingTests { JodaTimeFormattingConfigurer configurer = new JodaTimeFormattingConfigurer(); configurer.installJodaTimeFormatting(conversionService); - binder = new DataBinder(new JodaTimeBean()); + JodaTimeBean bean = new JodaTimeBean(); + bean.getChildren().add(new JodaTimeBean()); + binder = new DataBinder(bean); binder.setConversionService(conversionService); LocaleContextHolder.setLocale(Locale.US); @@ -90,7 +94,7 @@ public class JodaTimeFormattingTests { @Test public void testBindLocalDateArray() { MutablePropertyValues propertyValues = new MutablePropertyValues(); - propertyValues.add("localDate", new String[] { "10/31/09" }); + propertyValues.add("localDate", new String[] {"10/31/09"}); binder.bind(propertyValues); assertEquals(0, binder.getBindingResult().getErrorCount()); } @@ -104,6 +108,15 @@ public class JodaTimeFormattingTests { assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("localDateAnnotated")); } + @Test + public void testBindNestedLocalDateAnnotated() { + MutablePropertyValues propertyValues = new MutablePropertyValues(); + propertyValues.add("children[0].localDateAnnotated", "Oct 31, 2009"); + binder.bind(propertyValues); + assertEquals(0, binder.getBindingResult().getErrorCount()); + assertEquals("Oct 31, 2009", binder.getBindingResult().getFieldValue("children[0].localDateAnnotated")); + } + @Test public void testBindLocalDateAnnotatedWithDirectFieldAccess() { binder.initDirectFieldAccess(); @@ -337,6 +350,8 @@ public class JodaTimeFormattingTests { @DateTimeFormat(iso=ISO.DATE_TIME) private DateTime isoDateTime; + private final List children = new ArrayList(); + public LocalDate getLocalDate() { return localDate; } @@ -496,6 +511,10 @@ public class JodaTimeFormattingTests { public void setIsoDateTime(DateTime isoDateTime) { this.isoDateTime = isoDateTime; } - + + public List getChildren() { + return children; + } } -} \ No newline at end of file + +}