Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.1.1
-
None
-
snapshot 20080130, Spring 2.5.2
Description
BusApplicationContext extends ClassPathXmlApplicationContext and calls the super constructor (see below) with configLocations == null. In this constructor Spring 2.5.1 calls StringUtils.trimArrayElements(configLocations), which sets configLocations = new String[0], but Spring 2.5.2 no longer does this, which causes a NullPointerException in Spring. Copied here the relevant lines:
Spring 2.5.2:
public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent)
throws BeansException {
super(parent);
setConfigLocations(configLocations);
if (refresh)
}
/**
* Set the config locations for this application context.
* <p>If not set, the implementation may use a default as appropriate.
*/
public void setConfigLocations(String[] locations) {
Assert.noNullElements(locations, "Config locations must not be null");
this.configLocations = new String[locations.length];
for (int i = 0; i < locations.length; i++) { this.configLocations[i] = resolvePath(locations[i]); }
}
2.5.1:
public ClassPathXmlApplicationContext(String[] configLocations, boolean refresh, ApplicationContext parent)
throws BeansException {
super(parent);
Assert.noNullElements(configLocations, "Config location must not be null");
this.configLocations = StringUtils.trimArrayElements(configLocations);
if (refresh) { refresh(); }
}
public static String[] trimArrayElements(String[] array) {
if (ObjectUtils.isEmpty(array))
...
}
Would it be possible to pass an empty String array in BusApplicationContext to the parent constructor instead of null?