You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2021/03/10 09:55:23 UTC

[lucene] 03/04: add a test for passing in empty(null) option

This is an automated email from the ASF dual-hosted git repository.

dweiss pushed a commit to branch SOLR-14882
in repository https://gitbox.apache.org/repos/asf/lucene.git

commit 59c57fa214ddf4d9e00c8fa540dc4fc5a7ca3b45
Author: epugh <ep...@opensourceconnections.com>
AuthorDate: Mon Sep 21 12:02:18 2020 -0400

    add a test for passing in empty(null) option
---
 solr/core/src/java/org/apache/solr/util/ExportTool.java     | 6 ++++--
 solr/core/src/test/org/apache/solr/util/TestExportTool.java | 6 ++++++
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/util/ExportTool.java b/solr/core/src/java/org/apache/solr/util/ExportTool.java
index 2264c3c..9fa0b8a 100644
--- a/solr/core/src/java/org/apache/solr/util/ExportTool.java
+++ b/solr/core/src/java/org/apache/solr/util/ExportTool.java
@@ -128,9 +128,11 @@ public class ExportTool extends SolrCLI.ToolBase {
       if (limit == -1) limit = Long.MAX_VALUE;
     }
 
-    public void setOutFormat(String out, String format) {
+    public void setOutFormat(String out, String format) {      
+      if (format == null) {
+        format = "jsonl";
+      }
       this.format = format;
-      if (format == null) format = "json";
       if (!formats.contains(format)) {
         throw new IllegalArgumentException("format must be one of :" + formats);
       }
diff --git a/solr/core/src/test/org/apache/solr/util/TestExportTool.java b/solr/core/src/test/org/apache/solr/util/TestExportTool.java
index 97acc0c..5419baf 100644
--- a/solr/core/src/test/org/apache/solr/util/TestExportTool.java
+++ b/solr/core/src/test/org/apache/solr/util/TestExportTool.java
@@ -57,6 +57,12 @@ public class TestExportTool extends SolrCloudTestCase {
     info.setOutFormat(null, "json");
   }
 
+  public void testJsonlDefaultOutputFileFormat() throws Exception {
+    ExportTool.Info info = new ExportTool.MultiThreadedRunner("http://somesolr/mycollection/");
+    info.setOutFormat(null, null);
+    assertEquals("jsonl", info.format);
+  }
+
   public void testJsonlValidOutputFileFormat() throws Exception {
     ExportTool.Info info = new ExportTool.MultiThreadedRunner("http://somesolr/mycollection/");
     info.setOutFormat(null, "jsonl");