Browse Source

polishing

git-svn-id: https://src.springframework.org/svn/spring-framework/trunk@1928 50f2f4bb-b051-0410-bef5-90022cba6387
pull/1/head
Juergen Hoeller 17 years ago
parent
commit
472af43b0e
  1. 3
      org.springframework.beans/src/main/java/org/springframework/beans/BeanWrapperImpl.java
  2. 7
      org.springframework.beans/src/main/java/org/springframework/beans/factory/config/CustomEditorConfigurer.java
  3. 4
      org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java
  4. 10
      org.springframework.context/src/main/java/org/springframework/jndi/JndiTemplate.java

3
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) { catch (IllegalArgumentException ex) {
throw new TypeMismatchException(value, requiredType, ex); throw new TypeMismatchException(value, requiredType, ex);
} catch (IllegalStateException ex) { }
catch (IllegalStateException ex) {
throw new ConversionNotSupportedException(value, requiredType, ex); throw new ConversionNotSupportedException(value, requiredType, ex);
} }
} }

7
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with 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.PropertyEditorRegistrar;
import org.springframework.beans.factory.BeanClassLoaderAware; import org.springframework.beans.factory.BeanClassLoaderAware;
import org.springframework.core.Ordered; import org.springframework.core.Ordered;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils; import org.springframework.util.ClassUtils;
/** /**
@ -146,6 +147,7 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
} }
@SuppressWarnings("unchecked")
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (this.propertyEditorRegistrars != null) { if (this.propertyEditorRegistrars != null) {
for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) { for (PropertyEditorRegistrar propertyEditorRegistrar : this.propertyEditorRegistrars) {
@ -162,7 +164,8 @@ public class CustomEditorConfigurer implements BeanFactoryPostProcessor, BeanCla
try { try {
requiredType = ClassUtils.forName(key, this.beanClassLoader); requiredType = ClassUtils.forName(key, this.beanClassLoader);
Class editorClass = ClassUtils.forName(value, this.beanClassLoader); Class editorClass = ClassUtils.forName(value, this.beanClassLoader);
beanFactory.registerCustomEditor(requiredType, editorClass); Assert.isAssignable(PropertyEditor.class, editorClass);
beanFactory.registerCustomEditor(requiredType, (Class<? extends PropertyEditor>) editorClass);
} }
catch (ClassNotFoundException ex) { catch (ClassNotFoundException ex) {
if (this.ignoreUnresolvableEditors) { if (this.ignoreUnresolvableEditors) {

4
org.springframework.beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java

@ -16,7 +16,6 @@
package org.springframework.beans.factory.config; package org.springframework.beans.factory.config;
import java.util.HashSet;
import java.util.Properties; import java.util.Properties;
import org.springframework.beans.BeansException; 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.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware; import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.BeanNameAware; import org.springframework.beans.factory.BeanNameAware;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.core.Constants; import org.springframework.core.Constants;
import org.springframework.util.StringValueResolver;
import org.springframework.util.PropertyPlaceholderHelper; import org.springframework.util.PropertyPlaceholderHelper;
import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver; import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver;
import org.springframework.util.StringValueResolver;
/** /**
* A property resource configurer that resolves placeholders in bean property values of * A property resource configurer that resolves placeholders in bean property values of

10
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"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -149,7 +149,7 @@ public class JndiTemplate {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Looking up JNDI object with name [" + name + "]"); logger.debug("Looking up JNDI object with name [" + name + "]");
} }
return execute(new JndiCallback() { return execute(new JndiCallback<Object>() {
public Object doInContext(Context ctx) throws NamingException { public Object doInContext(Context ctx) throws NamingException {
Object located = ctx.lookup(name); Object located = ctx.lookup(name);
if (located == null) { if (located == null) {
@ -193,7 +193,7 @@ public class JndiTemplate {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Binding JNDI object with name [" + name + "]"); logger.debug("Binding JNDI object with name [" + name + "]");
} }
execute(new JndiCallback() { execute(new JndiCallback<Object>() {
public Object doInContext(Context ctx) throws NamingException { public Object doInContext(Context ctx) throws NamingException {
ctx.bind(name, object); ctx.bind(name, object);
return null; return null;
@ -212,7 +212,7 @@ public class JndiTemplate {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Rebinding JNDI object with name [" + name + "]"); logger.debug("Rebinding JNDI object with name [" + name + "]");
} }
execute(new JndiCallback() { execute(new JndiCallback<Object>() {
public Object doInContext(Context ctx) throws NamingException { public Object doInContext(Context ctx) throws NamingException {
ctx.rebind(name, object); ctx.rebind(name, object);
return null; return null;
@ -229,7 +229,7 @@ public class JndiTemplate {
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Unbinding JNDI object with name [" + name + "]"); logger.debug("Unbinding JNDI object with name [" + name + "]");
} }
execute(new JndiCallback() { execute(new JndiCallback<Object>() {
public Object doInContext(Context ctx) throws NamingException { public Object doInContext(Context ctx) throws NamingException {
ctx.unbind(name); ctx.unbind(name);
return null; return null;

Loading…
Cancel
Save