lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1726311 - in /lucene/dev/trunk/solr/contrib: dataimporthandler/src/test/org/apache/solr/handler/dataimport/ morphlines-cell/src/java/org/apache/solr/morphlines/cell/
Date Fri, 22 Jan 2016 21:05:40 GMT
Author: uschindler
Date: Fri Jan 22 21:05:40 2016
New Revision: 1726311

URL: http://svn.apache.org/viewvc?rev=1726311&view=rev
Log:
LUCENE-6978: Fix usage of Locale#toString in DIH

Modified:
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java
    lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolverEndToEnd.java
    lucene/dev/trunk/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java?rev=1726311&r1=1726310&r2=1726311&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java
(original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestBuiltInEvaluators.java
Fri Jan 22 21:05:40 2016
@@ -135,14 +135,14 @@ public class TestBuiltInEvaluators exten
       SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd HH", defaultLocale);
       String sdf = sdfDate.format(twoDaysAgo(defaultLocale, TimeZone.getDefault()));
       String dfe = dateFormatEval.evaluate(
-          "'NOW-2DAYS','yyyy-MM-dd HH','" + defaultLocale + "'", context);
+          "'NOW-2DAYS','yyyy-MM-dd HH','" + defaultLocale.toLanguageTag() + "'", context);
       assertEquals(sdf,dfe);
       for(String tzStr : TimeZone.getAvailableIDs()) {  
         TimeZone tz = TimeZone.getTimeZone(tzStr);
         sdfDate.setTimeZone(tz);
         sdf = sdfDate.format(twoDaysAgo(defaultLocale, tz));
         dfe = dateFormatEval.evaluate(
-            "'NOW-2DAYS','yyyy-MM-dd HH','" + defaultLocale + "','" + tzStr + "'", context);
+            "'NOW-2DAYS','yyyy-MM-dd HH','" + defaultLocale.toLanguageTag() + "','" + tzStr
+ "'", context);
         assertEquals(sdf,dfe);          
       }
     }
@@ -157,7 +157,7 @@ public class TestBuiltInEvaluators exten
         dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm'", context));
     assertEquals(
         new SimpleDateFormat("yyyy-MM-dd HH:mm", defaultLocale).format(d),
-        dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm','" + defaultLocale + "'", context));
+        dateFormatEval.evaluate("A.key, 'yyyy-MM-dd HH:mm','" + defaultLocale.toLanguageTag()
+ "'", context));
     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", defaultLocale);
     for(String tzStr : TimeZone.getAvailableIDs()) {
       TimeZone tz = TimeZone.getTimeZone(tzStr);
@@ -165,7 +165,7 @@ public class TestBuiltInEvaluators exten
       assertEquals(
           sdf.format(d),
           dateFormatEval.evaluate(
-              "A.key, 'yyyy-MM-dd HH:mm','" + defaultLocale + "', '" + tzStr + "'", context));
    
+              "A.key, 'yyyy-MM-dd HH:mm','" + defaultLocale.toLanguageTag() + "', '" + tzStr
+ "'", context));     
       
     }
     

Modified: lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolverEndToEnd.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolverEndToEnd.java?rev=1726311&r1=1726310&r2=1726311&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolverEndToEnd.java
(original)
+++ lucene/dev/trunk/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestVariableResolverEndToEnd.java
Fri Jan 22 21:05:40 2016
@@ -64,7 +64,7 @@ public class TestVariableResolverEndToEn
   
   @Override
   protected String generateConfig() {
-    String thirdLocaleParam = random().nextBoolean() ? "" : (", '" + Locale.getDefault()
+ "'");
+    String thirdLocaleParam = random().nextBoolean() ? "" : (", '" + Locale.getDefault().toLanguageTag()
+ "'");
     StringBuilder sb = new StringBuilder();
     sb.append("<dataConfig> \n");
     sb.append("<dataSource name=\"hsqldb\" driver=\"${dataimporter.request.dots.in.hsqldb.driver}\"
url=\"jdbc:hsqldb:mem:.\" /> \n");

Modified: lucene/dev/trunk/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java?rev=1726311&r1=1726310&r2=1726311&view=diff
==============================================================================
--- lucene/dev/trunk/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java
(original)
+++ lucene/dev/trunk/solr/contrib/morphlines-cell/src/java/org/apache/solr/morphlines/cell/SolrCellBuilder.java
Fri Jan 22 21:05:40 2016
@@ -163,7 +163,7 @@ public final class SolrCellBuilder imple
       }
       this.solrContentHandlerFactory = getSolrContentHandlerFactory(factoryClass, dateFormats,
config);
 
-      this.locale = getLocale(getConfigs().getString(config, "locale", ""));
+      this.locale = getLocale(getConfigs().getString(config, "locale", null));
       
       this.mediaTypeToParserMap = new HashMap<>();
       //MimeTypes mimeTypes = MimeTypes.getDefaultMimeTypes(); // FIXME getMediaTypeRegistry.normalize()

@@ -329,7 +329,7 @@ public final class SolrCellBuilder imple
     
     @SuppressForbidden(reason = "Usage of outdated locale parsing with Locale#toString()
because of backwards compatibility")
     private Locale getLocale(String name) {
-      if (name == null || name.isEmpty()) {
+      if (name == null) {
         return Locale.ROOT;
       }
       for (Locale locale : Locale.getAvailableLocales()) {



Mime
View raw message