SOLR-7610: Fix VelocityResponseWriter's .locale to accurately report locale in use

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1682900 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Erik Hatcher 2015-06-01 13:44:06 +00:00
parent 0b5cefb394
commit 1edc686c42
2 changed files with 5 additions and 3 deletions

View File

@ -106,6 +106,9 @@ Other Changes
* SOLR-7599: Remove cruft from SolrCloud tests. (shalin)
* SOLR-7610: Fix VelocityResponseWriter's $resource.locale to accurately report locale in use.
(ehatcher)
================== 5.2.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release

View File

@ -326,19 +326,18 @@ public class VelocityResponseWriter implements QueryResponseWriter, SolrCoreAwar
// see: http://svn.apache.org/repos/asf/velocity/tools/branches/2.0.x/src/main/java/org/apache/velocity/tools/generic/ResourceTool.java
private class SolrVelocityResourceTool extends ResourceTool {
private final Locale locale;
private ClassLoader solrClassLoader;
public SolrVelocityResourceTool(ClassLoader cl, String localeString) {
this.solrClassLoader = cl;
Locale l = toLocale(localeString);
this.locale = (l == null ? Locale.ROOT : l);
this.setLocale(l == null ? Locale.ROOT : l);
}
@Override
protected ResourceBundle getBundle(String baseName, Object loc) {
// resource bundles for this tool must be in velocity "package"
return ResourceBundle.getBundle("velocity." + baseName, locale, solrClassLoader);
return ResourceBundle.getBundle("velocity." + baseName, getLocale(), solrClassLoader);
}
// Why did Velocity Tools make this private? Copied from ResourceTools.java