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 d17ad0cd84e..c3f287e2dbd 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 @@ -393,7 +393,8 @@ public class BeanWrapperImpl extends AbstractPropertyAccessor implements BeanWra } catch (IllegalArgumentException ex) { throw new TypeMismatchException(value, requiredType, ex); - } catch (IllegalStateException ex) { + } + catch (IllegalStateException ex) { throw new ConversionNotSupportedException(value, requiredType, ex); } } diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java index acbd3dd01fd..1b18a4540dc 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -27,6 +27,7 @@ import org.springframework.beans.FatalBeanException; import org.springframework.beans.PropertyEditorRegistrar; import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.core.Ordered; +import org.springframework.util.Assert; import org.springframework.util.ClassUtils; /** @@ -146,6 +147,7 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla } + @SuppressWarnings("unchecked") public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { if (this.propertyEditorRegistrars != null) { for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) { @@ -162,7 +164,8 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla try { requiredType = ClassUtils.forName(key, this.beanClassLoader); Class editorClass = ClassUtils.forName(value, this.beanClassLoader); - beanFactory.registerCustomEditor(requiredType, editorClass); + Assert.isAssignable(PropertyEditor.class, editorClass); + beanFactory.registerCustomEditor(requiredType, (Class) editorClass); } catch (ClassNotFoundException ex) { if (this.ignoreUnresolvableEditors) { diff --git a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java index 082c83bf754..5c7b5706389 100644 --- a/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java +++ b/org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java @@ -16,7 +16,6 @@ package org.springframework.beans.factory.config; -import java.util.HashSet; import java.util.Properties; import org.springframework.beans.BeansException; @@ -24,11 +23,10 @@ import org.springframework.beans.factory.BeanDefinitionStoreException; import org.springframework.beans.factory.BeanFactory; import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanNameAware; -import org.springframework.beans.factory.InitializingBean; import org.springframework.core.Constants; -import org.springframework.util.StringValueResolver; import org.springframework.util.PropertyPlaceholderHelper; import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; +import org.springframework.util.StringValueResolver; /** * A property resource configurer that resolves placeholders in bean property values of diff --git a/org.springframework.context/src/main/java/org/springframework/jndi/JndiTemplate.java b/org.springframework.context/src/main/java/org/springframework/jndi/JndiTemplate.java index a9dda09e9c7..ad9fbf09a34 100644 --- a/org.springframework.context/src/main/java/org/springframework/jndi/JndiTemplate.java +++ b/org.springframework.context/src/main/java/org/springframework/jndi/JndiTemplate.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2009 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. @@ -149,7 +149,7 @@ public class JndiTemplate { if (logger.isDebugEnabled()) { logger.debug("Looking up JNDI object with name [" + name + "]"); } - return execute(new JndiCallback() { + return execute(new JndiCallback() { public Object doInContext(Context ctx) throws NamingException { Object located = ctx.lookup(name); if (located == null) { @@ -193,7 +193,7 @@ public class JndiTemplate { if (logger.isDebugEnabled()) { logger.debug("Binding JNDI object with name [" + name + "]"); } - execute(new JndiCallback() { + execute(new JndiCallback() { public Object doInContext(Context ctx) throws NamingException { ctx.bind(name, object); return null; @@ -212,7 +212,7 @@ public class JndiTemplate { if (logger.isDebugEnabled()) { logger.debug("Rebinding JNDI object with name [" + name + "]"); } - execute(new JndiCallback() { + execute(new JndiCallback() { public Object doInContext(Context ctx) throws NamingException { ctx.rebind(name, object); return null; @@ -229,7 +229,7 @@ public class JndiTemplate { if (logger.isDebugEnabled()) { logger.debug("Unbinding JNDI object with name [" + name + "]"); } - execute(new JndiCallback() { + execute(new JndiCallback() { public Object doInContext(Context ctx) throws NamingException { ctx.unbind(name); return null;