Skip to content

ResourcePropertySource cannot load JDK 5 properties xml [SPR-9896] #14529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Oct 20, 2012 · 1 comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

KwonNam Son opened SPR-9896 and commented

ResourcePropertySource cannot load JDK 5 properties XML.

I think that ResourcePropertySource#loadPropertiesForResource method's props.load(is) line has to be like the following:

String filename = resource.getFilename();
if (filename != null && filename.toLowerCase().endsWith(".xml")) {
	props.loadFromXML(is);
} else {
	props.load(is);
}

or just use PropertiesLoaderSupport class for loading properties.


Affects: 3.1.2

Referenced from: commits d5cad15, 3a626f9, a420e84

Backported to: 3.1.4

@spring-projects-issues
Copy link
Collaborator Author

Chris Beams commented

Thanks, KwonNam. This is resolved.

commit 3a626f93197d7f0fd4266d9877550a8d330017e5
Author: Chris Beams <cbeams@vmware.com>
Commit: Chris Beams <cbeams@vmware.com>

    Support XML properties in ResourcePropertySource
    
    JDK 5 introduced an XML-based properties file syntax. This commit
    ensures that when such files are supplied as the underlying resource
    for a ResourcePropertySource instance, they are routed appropriately
    to Properties#loadFromXML as opposed to Properties#load.
    
    Issue: SPR-9896

@spring-projects-issues spring-projects-issues added status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 3.2.1 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: backported An issue that has been backported to maintenance branches type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant