Browse Source

ReloadableResourceBundleMessageSource sets file timestamp on merged holder

Issue: SPR-14583
pull/22835/head
Juergen Hoeller 8 years ago
parent
commit
03468fd9ed
  1. 6
      spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java

6
spring-context/src/main/java/org/springframework/context/support/ReloadableResourceBundleMessageSource.java

@ -237,7 +237,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased @@ -237,7 +237,7 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
return mergedHolder;
}
Properties mergedProps = newProperties();
mergedHolder = new PropertiesHolder(mergedProps, -1);
long latestTimestamp = -1;
String[] basenames = StringUtils.toStringArray(getBasenameSet());
for (int i = basenames.length - 1; i >= 0; i--) {
List<String> filenames = calculateAllFilenames(basenames[i], locale);
@ -246,9 +246,13 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased @@ -246,9 +246,13 @@ public class ReloadableResourceBundleMessageSource extends AbstractResourceBased
PropertiesHolder propHolder = getProperties(filename);
if (propHolder.getProperties() != null) {
mergedProps.putAll(propHolder.getProperties());
if (propHolder.getFileTimestamp() > latestTimestamp) {
latestTimestamp = propHolder.getFileTimestamp();
}
}
}
}
mergedHolder = new PropertiesHolder(mergedProps, latestTimestamp);
PropertiesHolder existing = this.cachedMergedProperties.putIfAbsent(locale, mergedHolder);
if (existing != null) {
mergedHolder = existing;

Loading…
Cancel
Save