diff --git a/org.springframework.core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java b/org.springframework.core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java index 97b37690d4..e4b4147a40 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java +++ b/org.springframework.core/src/main/java/org/springframework/core/io/support/PropertiesLoaderSupport.java @@ -180,11 +180,10 @@ public abstract class PropertiesLoaderSupport { try { is = location.getInputStream(); - if (location instanceof AbstractFileResolvingResource) { - String filename = location.getFilename(); - if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { - this.propertiesPersister.loadFromXml(props, is); - } + String filename = (location instanceof AbstractFileResolvingResource) ? + location.getFilename() : null; + if (filename != null && filename.endsWith(XML_FILE_EXTENSION)) { + this.propertiesPersister.loadFromXml(props, is); } else { if (this.fileEncoding != null) {