Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-1435

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.1.1
    • 2.0.5
    • Configuration
    • 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)

      { 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?

      Attachments

        Issue Links

          Activity

            People

              dkulp Daniel Kulp
              orbang Gyorgy Orban
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: