You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Gyorgy Orban (JIRA)" <ji...@apache.org> on 2008/02/15 15:52:08 UTC

[jira] Created: (CXF-1435) BusApplicationContext should pass empty String array to super constructor instead of null

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.


[jira] Updated: (CXF-1435) BusApplicationContext should pass empty String array to super constructor instead of null

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp updated CXF-1435:
-----------------------------

    Fix Version/s:     (was: 2.0.4)
                   2.0.5

> 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
>            Assignee: Daniel Kulp
>             Fix For: 2.0.5
>
>
> 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.


[jira] Resolved: (CXF-1435) BusApplicationContext should pass empty String array to super constructor instead of null

Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CXF-1435?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved CXF-1435.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.4
         Assignee: Daniel Kulp

> 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
>            Assignee: Daniel Kulp
>             Fix For: 2.0.4
>
>
> 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.