polishing

This commit is contained in:
Juergen Hoeller
2009-10-13 20:59:10 +00:00
parent 84447cdf94
commit b4ffdcdf18
6 changed files with 94 additions and 77 deletions

View File

@@ -136,8 +136,7 @@ public class PropertyBatchUpdateException extends BeansException {
if (exType.isInstance(this)) {
return true;
}
for (int i = 0; i < this.propertyAccessExceptions.length; i++) {
PropertyAccessException pae = this.propertyAccessExceptions[i];
for (PropertyAccessException pae : this.propertyAccessExceptions) {
if (pae.contains(exType)) {
return true;
}

View File

@@ -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.
@@ -74,6 +74,7 @@ public class CustomScopeConfigurer implements BeanFactoryPostProcessor, BeanClas
}
@SuppressWarnings("unchecked")
public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
if (this.scopes != null) {
for (Map.Entry<String, Object> entry : this.scopes.entrySet()) {

View File

@@ -426,10 +426,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (System.getSecurityManager() != null) {
return AccessController.doPrivileged(new PrivilegedAction<Boolean>() {
public Boolean run() {
return Boolean.valueOf(((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
!factoryBean.isSingleton()));
return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
!factoryBean.isSingleton());
}
}, getAccessControlContext()).booleanValue();
}, getAccessControlContext());
}
else {
return ((factoryBean instanceof SmartFactoryBean && ((SmartFactoryBean) factoryBean).isPrototype()) ||
@@ -1015,9 +1015,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (!this.customEditors.isEmpty()) {
for (Map.Entry<Class, Class<? extends PropertyEditor>> entry : this.customEditors.entrySet()) {
Class requiredType = entry.getKey();
Class editorClass = entry.getValue();
registry.registerCustomEditor(requiredType,
(PropertyEditor) BeanUtils.instantiateClass(editorClass));
Class<? extends PropertyEditor> editorClass = entry.getValue();
registry.registerCustomEditor(requiredType, BeanUtils.instantiateClass(editorClass));
}
}
}
@@ -1196,10 +1195,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
if (mbd.hasBeanClass()) {
return mbd.getBeanClass();
}
if (System.getSecurityManager() != null) {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class>() {
public Class run() throws Exception {
return doResolveBeanClass(mbd, typesToMatch);
}
@@ -1211,10 +1208,10 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
}
catch (PrivilegedActionException pae) {
ClassNotFoundException ex = (ClassNotFoundException) pae.getException();
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), (ClassNotFoundException) ex);
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), ex);
}
catch (ClassNotFoundException ex) {
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), (ClassNotFoundException) ex);
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), ex);
}
catch (LinkageError err) {
throw new CannotLoadBeanClassException(mbd.getResourceDescription(), beanName, mbd.getBeanClassName(), err);

View File

@@ -518,8 +518,8 @@ public class BeanDefinitionParserDelegate {
}
else if (ele.hasAttribute(SINGLETON_ATTRIBUTE)) {
// Spring 1.x "singleton" attribute
bd.setScope(TRUE_VALUE.equals(ele.getAttribute(SINGLETON_ATTRIBUTE)) ? BeanDefinition.SCOPE_SINGLETON
: BeanDefinition.SCOPE_PROTOTYPE);
bd.setScope(TRUE_VALUE.equals(ele.getAttribute(SINGLETON_ATTRIBUTE)) ?
BeanDefinition.SCOPE_SINGLETON : BeanDefinition.SCOPE_PROTOTYPE);
}
else if (containingBean != null) {
// Take default from containing bean in case of an inner bean definition.