BATCH-1289: Add null-check to CoreNamespaceUtils.rangeArrayEditorAlreadyDefined() for a CustomEditorConfigurer with no customEditors property.
This commit is contained in:
@@ -18,6 +18,7 @@ package org.springframework.batch.core.configuration.xml;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.PropertyValue;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.config.TypedStringValue;
|
||||
import org.springframework.beans.factory.support.AbstractBeanDefinition;
|
||||
@@ -97,16 +98,18 @@ public class CoreNamespaceUtils {
|
||||
for (String beanName : registry.getBeanDefinitionNames()) {
|
||||
BeanDefinition bd = registry.getBeanDefinition(beanName);
|
||||
if (CUSTOM_EDITOR_CONFIGURER_CLASS_NAME.equals(bd.getBeanClassName())) {
|
||||
Map editors = (Map) bd.getPropertyValues().getPropertyValue("customEditors").getValue();
|
||||
for (Map.Entry entry : (Set<Map.Entry>) editors.entrySet()) {
|
||||
if (entry.getKey() instanceof TypedStringValue) {
|
||||
if (RANGE_ARRAY_CLASS_NAME.equals(((TypedStringValue) entry.getKey()).getValue())) {
|
||||
return true;
|
||||
PropertyValue pv = bd.getPropertyValues().getPropertyValue("customEditors");
|
||||
if (pv != null) {
|
||||
for (Map.Entry entry : (Set<Map.Entry>) ((Map) pv.getValue()).entrySet()) {
|
||||
if (entry.getKey() instanceof TypedStringValue) {
|
||||
if (RANGE_ARRAY_CLASS_NAME.equals(((TypedStringValue) entry.getKey()).getValue())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entry.getKey() instanceof String) {
|
||||
if (RANGE_ARRAY_CLASS_NAME.equals((String) entry.getKey())) {
|
||||
return true;
|
||||
else if (entry.getKey() instanceof String) {
|
||||
if (RANGE_ARRAY_CLASS_NAME.equals((String) entry.getKey())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,9 @@
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/batch http://www.springframework.org/schema/batch/spring-batch-2.0.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
|
||||
|
||||
<!-- Ensure that no error is thrown from CoreNamespaceUtils due to an empty configurer -->
|
||||
<beans:bean class="org.springframework.beans.factory.config.CustomEditorConfigurer"/>
|
||||
|
||||
<beans:import resource="common-context.xml" />
|
||||
|
||||
<job id="job1" parent="baseJob">
|
||||
|
||||
Reference in New Issue
Block a user