BusApplicationContext should pass empty String array to super constructor 
instead of null
-----------------------------------------------------------------------------------------

                 Key: CXF-1435
                 URL: https://issues.apache.org/jira/browse/CXF-1435
             Project: CXF
          Issue Type: Bug
          Components: Configuration
    Affects Versions: 2.1.1
         Environment: snapshot 20080130, Spring 2.5.2 
            Reporter: Gyorgy Orban


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) {
                        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)) {
                        return new String[0];
                }
                ...
        }

Would it be possible to pass an empty String array in BusApplicationContext to 
the parent constructor instead of null?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to