From 7fa9ca0cae8b31afd63f24ca394c4b48f1992ee4 Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Tue, 9 Feb 2016 08:49:39 +0100 Subject: [PATCH] More incorrect usage of default Locale --- .../src/java/org/apache/solr/schema/EnumField.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/schema/EnumField.java b/solr/core/src/java/org/apache/solr/schema/EnumField.java index 9f79068cf54..ad83a2802bf 100644 --- a/solr/core/src/java/org/apache/solr/schema/EnumField.java +++ b/solr/core/src/java/org/apache/solr/schema/EnumField.java @@ -67,7 +67,6 @@ import org.xml.sax.SAXException; public class EnumField extends PrimitiveFieldType { private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - protected static final Locale LOCALE = Locale.getDefault(); protected static final String PARAM_ENUMS_CONFIG = "enumsConfig"; protected static final String PARAM_ENUM_NAME = "enumName"; protected static final Integer DEFAULT_VALUE = -1; @@ -103,11 +102,11 @@ public class EnumField extends PrimitiveFieldType { final Document doc = dbf.newDocumentBuilder().parse(is); final XPathFactory xpathFactory = XPathFactory.newInstance(); final XPath xpath = xpathFactory.newXPath(); - final String xpathStr = String.format(LOCALE, "/enumsConfig/enum[@name='%s']", enumName); + final String xpathStr = String.format(Locale.ROOT, "/enumsConfig/enum[@name='%s']", enumName); final NodeList nodes = (NodeList) xpath.evaluate(xpathStr, doc, XPathConstants.NODESET); final int nodesLength = nodes.getLength(); if (nodesLength == 0) { - String exceptionMessage = String.format(LOCALE, "No enum configuration found for enum '%s' in %s.", + String exceptionMessage = String.format(Locale.ENGLISH, "No enum configuration found for enum '%s' in %s.", enumName, enumsConfigFile); throw new SolrException(SolrException.ErrorCode.NOT_FOUND, exceptionMessage); } @@ -121,12 +120,12 @@ public class EnumField extends PrimitiveFieldType { final Node valueNode = valueNodes.item(i); final String valueStr = valueNode.getTextContent(); if ((valueStr == null) || (valueStr.length() == 0)) { - final String exceptionMessage = String.format(LOCALE, "A value was defined with an no value in enum '%s' in %s.", + final String exceptionMessage = String.format(Locale.ENGLISH, "A value was defined with an no value in enum '%s' in %s.", enumName, enumsConfigFile); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMessage); } if (enumStringToIntMap.containsKey(valueStr)) { - final String exceptionMessage = String.format(LOCALE, "A duplicated definition was found for value '%s' in enum '%s' in %s.", + final String exceptionMessage = String.format(Locale.ENGLISH, "A duplicated definition was found for value '%s' in enum '%s' in %s.", valueStr, enumName, enumsConfigFile); throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, exceptionMessage); } @@ -152,7 +151,7 @@ public class EnumField extends PrimitiveFieldType { } if ((enumStringToIntMap.size() == 0) || (enumIntToStringMap.size() == 0)) { - String exceptionMessage = String.format(LOCALE, "Invalid configuration was defined for enum '%s' in %s.", + String exceptionMessage = String.format(Locale.ENGLISH, "Invalid configuration was defined for enum '%s' in %s.", enumName, enumsConfigFile); throw new SolrException(SolrException.ErrorCode.NOT_FOUND, exceptionMessage); }