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 fda4003b7da..14c6dfef773 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 @@ -355,7 +355,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra public TypeDescriptor getPropertyTypeDescriptor(String propertyName) throws BeansException { try { - PropertyDescriptor pd = getPropertyDescriptorInternal(propertyName); + String actualPropertyName = PropertyAccessorUtils.getPropertyName(propertyName); + PropertyDescriptor pd = getPropertyDescriptorInternal(actualPropertyName); if (pd != null) { Class type = getPropertyType(propertyName); if (pd.getReadMethod() != null) { diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java b/org.springframework.beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java index a433ec959d9..53d13772826 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/PropertyAccessorUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 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. @@ -32,7 +32,8 @@ public abstract class PropertyAccessorUtils { * @return the actual property name, without any key elements */ public static String getPropertyName(String propertyPath) { - int separatorIndex = propertyPath.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR); + int separatorIndex = (propertyPath.endsWith(PropertyAccessor.PROPERTY_KEY_SUFFIX) ? + propertyPath.indexOf(PropertyAccessor.PROPERTY_KEY_PREFIX_CHAR) : -1); return (separatorIndex != -1 ? propertyPath.substring(0, separatorIndex) : propertyPath); }