lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sar...@apache.org
Subject lucene-solr git commit: SOLR-8778: Deprecate CSVStrategy's setters, and make its pre-configured strategies immutable
Date Thu, 03 Mar 2016 15:57:17 GMT
Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 8e18b1ea5 -> eb0c3bd90


SOLR-8778: Deprecate CSVStrategy's setters, and make its pre-configured strategies immutable


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/eb0c3bd9
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/eb0c3bd9
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/eb0c3bd9

Branch: refs/heads/branch_6x
Commit: eb0c3bd90a4feee61b7c9b4c21a78a9f9bace0ff
Parents: 8e18b1e
Author: Steve Rowe <sarowe@apache.org>
Authored: Thu Mar 3 10:54:45 2016 -0500
Committer: Steve Rowe <sarowe@apache.org>
Committed: Thu Mar 3 10:57:03 2016 -0500

----------------------------------------------------------------------
 solr/CHANGES.txt                                |   2 +
 .../solr/handler/loader/CSVLoaderBase.java      |   5 +-
 .../apache/solr/internal/csv/CSVStrategy.java   | 325 ++++++++++++-------
 .../apache/solr/response/CSVResponseWriter.java |   6 +-
 .../apache/solr/internal/csv/CSVParserTest.java |  10 +-
 .../solr/internal/csv/CSVPrinterTest.java       |   3 +-
 6 files changed, 233 insertions(+), 118 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb0c3bd9/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index b0a4085..115aae7 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -377,6 +377,8 @@ Other Changes
 
 * SOLR-8780: Remove unused OverseerCollectionMessageHandler#getClusterStatus method. (Varun
Thacker)
 
+* SOLR-8778: Deprecate CSVStrategy's setters, and make its pre-configured strategies immutable.
(Steve Rowe)
+
 ==================  5.5.1 ==================
 
 Bug Fixes

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb0c3bd9/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java b/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java
index 12e41c5..84c82d7 100644
--- a/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java
+++ b/solr/core/src/java/org/apache/solr/handler/loader/CSVLoaderBase.java
@@ -165,7 +165,7 @@ abstract class CSVLoaderBase extends ContentStreamLoader {
     templateAdd.overwrite=params.getBool(OVERWRITE,true);
     templateAdd.commitWithin = params.getInt(UpdateParams.COMMIT_WITHIN, -1);
     
-    strategy = new CSVStrategy(',', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED,
false, false, false, true);
+    strategy = new CSVStrategy(',', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED,
false, false, false, true, "\n");
     String sep = params.get(SEPARATOR);
     if (sep!=null) {
       if (sep.length()!=1) throw new SolrException( SolrException.ErrorCode.BAD_REQUEST,"Invalid
separator:'"+sep+"'");
@@ -274,7 +274,8 @@ abstract class CSVLoaderBase extends ContentStreamLoader {
         String escStr = params.getFieldParam(fname,ESCAPE);
         char fesc = escStr==null || escStr.length()==0 ? CSVStrategy.ESCAPE_DISABLED : escStr.charAt(0);
 
-        CSVStrategy fstrat = new CSVStrategy(fsep,fenc,CSVStrategy.COMMENTS_DISABLED,fesc,
false, false, false, false);
+        CSVStrategy fstrat = new CSVStrategy
+            (fsep, fenc, CSVStrategy.COMMENTS_DISABLED, fesc, false, false, false, false,
"\n");
         adders[i] = new CSVLoaderBase.FieldSplitter(fstrat, adders[i]);
       }
     }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb0c3bd9/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java b/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java
index e27c9c3..930bbe0 100644
--- a/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java
+++ b/solr/core/src/java/org/apache/solr/internal/csv/CSVStrategy.java
@@ -20,119 +20,226 @@ import java.io.Serializable;
 
 /**
  * CSVStrategy
- * 
+ *
  * Represents the strategy for a CSV.
  */
 public class CSVStrategy implements Cloneable, Serializable {
 
-    private char delimiter;
-    private char encapsulator;
-    private char commentStart;
-    private char escape;
-    private boolean ignoreLeadingWhitespaces;
-    private boolean ignoreTrailingWhitespaces;
-    private boolean interpretUnicodeEscapes;
-    private boolean ignoreEmptyLines;
-
-    // controls for output
-    private String printerNewline = "\n";
-
-    // -2 is used to signal disabled, because it won't be confused with
-    // an EOF signal (-1), and because \ufffe in UTF-16 would be
-    // encoded as two chars (using surrogates) and thus there should never
-    // be a collision with a real text char.
-    public static char COMMENTS_DISABLED       = (char)-2;
-    public static char ESCAPE_DISABLED         = (char)-2;
-    public static char ENCAPSULATOR_DISABLED   = (char)-2;
-
-    public static CSVStrategy DEFAULT_STRATEGY = new CSVStrategy(',', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, true, 
-                                                                 true, false, true);
-    public static CSVStrategy EXCEL_STRATEGY   = new CSVStrategy(',', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, false, 
-                                                                 false, false, false);
-    public static CSVStrategy TDF_STRATEGY     = new CSVStrategy('\t', '"', COMMENTS_DISABLED,
ESCAPE_DISABLED, true, 
-                                                                 true, false, true);
-
-
-    public CSVStrategy(char delimiter, char encapsulator, char commentStart) {
-        this(delimiter, encapsulator, commentStart, ESCAPE_DISABLED, true, true, false, true);
-    }
-  
-    /**
-     * Customized CSV strategy setter.
-     * 
-     * @param delimiter a Char used for value separation
-     * @param encapsulator a Char used as value encapsulation marker
-     * @param commentStart a Char used for comment identification
-     * @param ignoreLeadingWhitespace TRUE when leading whitespaces should be
-     *                                ignored
-     * @param interpretUnicodeEscapes TRUE when unicode escapes should be 
-     *                                interpreted
-     * @param ignoreEmptyLines TRUE when the parser should skip emtpy lines
-     */
-    public CSVStrategy(
-        char delimiter, 
-        char encapsulator, 
-        char commentStart,
-        char escape,
-        boolean ignoreLeadingWhitespace, 
-        boolean ignoreTrailingWhitespace, 
-        boolean interpretUnicodeEscapes,
-        boolean ignoreEmptyLines) 
-    {
-        setDelimiter(delimiter);
-        setEncapsulator(encapsulator);
-        setCommentStart(commentStart);
-        setEscape(escape);
-        setIgnoreLeadingWhitespaces(ignoreLeadingWhitespace);
-        setIgnoreTrailingWhitespaces(ignoreTrailingWhitespace);
-        setUnicodeEscapeInterpretation(interpretUnicodeEscapes);
-        setIgnoreEmptyLines(ignoreEmptyLines);
-    }
-
-    public void setDelimiter(char delimiter) { this.delimiter = delimiter; }
-    public char getDelimiter() { return this.delimiter; }
-
-    public void setEncapsulator(char encapsulator) { this.encapsulator = encapsulator; }
-    public char getEncapsulator() { return this.encapsulator; }
-
-    public void setCommentStart(char commentStart) { this.commentStart = commentStart; }
-    public char getCommentStart() { return this.commentStart; }
-    public boolean isCommentingDisabled() { return this.commentStart == COMMENTS_DISABLED;
}
-
-    public void setEscape(char escape) { this.escape = escape; }
-    public char getEscape() { return this.escape; }
-
-    public void setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces) { 
-        this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces; 
-    }
-    public boolean getIgnoreLeadingWhitespaces() { return this.ignoreLeadingWhitespaces;
}
-
-    public void setIgnoreTrailingWhitespaces(boolean ignoreTrailingWhitespaces) { 
-        this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces; 
-    }
-    public boolean getIgnoreTrailingWhitespaces() { return this.ignoreTrailingWhitespaces;
}
-
-    public void setUnicodeEscapeInterpretation(boolean interpretUnicodeEscapes) { 
-        this.interpretUnicodeEscapes = interpretUnicodeEscapes; 
-    }
-    public boolean getUnicodeEscapeInterpretation() { return this.interpretUnicodeEscapes;
}
-
-    public void setIgnoreEmptyLines(boolean ignoreEmptyLines) { this.ignoreEmptyLines = ignoreEmptyLines;
}
-    public boolean getIgnoreEmptyLines() { return this.ignoreEmptyLines; }
-
-    public void setPrinterNewline(String newline) {
-      this.printerNewline = newline;
-    }
-    public String getPrinterNewline() {
-      return this.printerNewline;
+  private char delimiter;
+  private char encapsulator;
+  private char commentStart;
+  private char escape;
+  private boolean ignoreLeadingWhitespaces;
+  private boolean ignoreTrailingWhitespaces;
+  private boolean interpretUnicodeEscapes;
+  private boolean ignoreEmptyLines;
+
+  // controls for output
+  private String printerNewline;
+
+  // -2 is used to signal disabled, because it won't be confused with
+  // an EOF signal (-1), and because \ufffe in UTF-16 would be
+  // encoded as two chars (using surrogates) and thus there should never
+  // be a collision with a real text char.
+  public static char COMMENTS_DISABLED       = (char)-2;
+  public static char ESCAPE_DISABLED         = (char)-2;
+  public static char ENCAPSULATOR_DISABLED   = (char)-2;
+  public static String DEFAULT_PRINTER_NEWLINE = "\n";
+
+  public static final CSVStrategy DEFAULT_STRATEGY = new ImmutableCSVStrategy
+      (',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true, DEFAULT_PRINTER_NEWLINE);
+  public static final CSVStrategy EXCEL_STRATEGY = new ImmutableCSVStrategy
+      (',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, false, DEFAULT_PRINTER_NEWLINE);
+  public static final CSVStrategy TDF_STRATEGY = new ImmutableCSVStrategy
+      ('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true, DEFAULT_PRINTER_NEWLINE);
+
+  public CSVStrategy(char delimiter, char encapsulator, char commentStart) {
+    this(delimiter, encapsulator, commentStart, ESCAPE_DISABLED, true, true, false, true,
DEFAULT_PRINTER_NEWLINE);
+  }
+
+  /**
+   * Customized CSV strategy setter.
+   *
+   * @param delimiter a Char used for value separation
+   * @param encapsulator a Char used as value encapsulation marker
+   * @param commentStart a Char used for comment identification
+   * @param escape a Char used for escaping
+   * @param ignoreTrailingWhitespaces TRUE when trailing whitespaces should be
+   *                                 ignored
+   * @param ignoreLeadingWhitespaces TRUE when leading whitespaces should be
+   *                                ignored
+   * @param interpretUnicodeEscapes TRUE when unicode escapes should be
+   *                                interpreted
+   * @param ignoreEmptyLines TRUE when the parser should skip emtpy lines
+   * @param printerNewline The string to use when printing a newline
+   */
+  public CSVStrategy(char delimiter, char encapsulator, char commentStart, char escape,
+      boolean ignoreLeadingWhitespaces, boolean ignoreTrailingWhitespaces,
+      boolean interpretUnicodeEscapes, boolean ignoreEmptyLines,
+      String printerNewline) {
+    this.delimiter = delimiter;
+    this.encapsulator = encapsulator;
+    this.commentStart = commentStart;
+    this.escape = escape;
+    this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces;
+    this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces;
+    this.interpretUnicodeEscapes = interpretUnicodeEscapes;
+    this.ignoreEmptyLines = ignoreEmptyLines;
+    this.printerNewline = printerNewline;
+  }
+
+  /**
+   * Customized CSV strategy setter.
+   *
+   * @param delimiter a Char used for value separation
+   * @param encapsulator a Char used as value encapsulation marker
+   * @param commentStart a Char used for comment identification
+   * @param escape a Char used for escaping
+   * @param ignoreTrailingWhitespaces TRUE when trailing whitespaces should be
+   *                                 ignored
+   * @param ignoreLeadingWhitespaces TRUE when leading whitespaces should be
+   *                                ignored
+   * @param interpretUnicodeEscapes TRUE when unicode escapes should be
+   *                                interpreted
+   * @param ignoreEmptyLines TRUE when the parser should skip emtpy lines
+   * @deprecated Use the ctor that also takes printerNewline.  This ctor will be removed
in Solr 7.
+   */
+  @Deprecated
+  public CSVStrategy(char delimiter, char encapsulator, char commentStart, char escape,
+                     boolean ignoreLeadingWhitespaces, boolean ignoreTrailingWhitespaces,
+                     boolean interpretUnicodeEscapes, boolean ignoreEmptyLines) {
+    this(delimiter, encapsulator, commentStart, escape,
+        ignoreLeadingWhitespaces, ignoreTrailingWhitespaces,
+        interpretUnicodeEscapes, ignoreEmptyLines,
+        DEFAULT_PRINTER_NEWLINE);
+  }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setDelimiter(char delimiter) { this.delimiter = delimiter; }
+  public char getDelimiter() { return this.delimiter; }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setEncapsulator(char encapsulator) { this.encapsulator = encapsulator; }
+  public char getEncapsulator() { return this.encapsulator; }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setCommentStart(char commentStart) { this.commentStart = commentStart; }
+  public char getCommentStart() { return this.commentStart; }
+  public boolean isCommentingDisabled() { return this.commentStart == COMMENTS_DISABLED;
}
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setEscape(char escape) { this.escape = escape; }
+  public char getEscape() { return this.escape; }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces) {
+    this.ignoreLeadingWhitespaces = ignoreLeadingWhitespaces;
+  }
+  public boolean getIgnoreLeadingWhitespaces() { return this.ignoreLeadingWhitespaces; }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setIgnoreTrailingWhitespaces(boolean ignoreTrailingWhitespaces) {
+    this.ignoreTrailingWhitespaces = ignoreTrailingWhitespaces;
+  }
+  public boolean getIgnoreTrailingWhitespaces() { return this.ignoreTrailingWhitespaces;
}
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setUnicodeEscapeInterpretation(boolean interpretUnicodeEscapes) {
+    this.interpretUnicodeEscapes = interpretUnicodeEscapes;
+  }
+  public boolean getUnicodeEscapeInterpretation() { return this.interpretUnicodeEscapes;
}
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setIgnoreEmptyLines(boolean ignoreEmptyLines) { this.ignoreEmptyLines = ignoreEmptyLines;
}
+  public boolean getIgnoreEmptyLines() { return this.ignoreEmptyLines; }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  public void setPrinterNewline(String newline) {
+    this.printerNewline = newline;
+  }
+  public String getPrinterNewline() {
+    return this.printerNewline;
+  }
+
+  /** @deprecated will be removed in Solr 7 */
+  @Deprecated
+  @Override
+  public Object clone() {
+    try {
+      return super.clone();
+    } catch (CloneNotSupportedException e) {
+      throw new RuntimeException(e);  // impossible
     }
+  }
+}
 
-    @Override
-    public Object clone() {
-      try {
-        return super.clone();
-      } catch (CloneNotSupportedException e) {
-        throw new RuntimeException(e);  // impossible
-      }
-    }
+/**
+ * @deprecated will be removed in Solr 7
+ * @lucene.internal
+ */
+@Deprecated
+class ImmutableCSVStrategy extends CSVStrategy {
+  ImmutableCSVStrategy(char delimiter, char encapsulator, char commentStart, char escape,
+                       boolean ignoreLeadingWhitespaces, boolean ignoreTrailingWhitespaces,
+                       boolean interpretUnicodeEscapes, boolean ignoreEmptyLines,
+                       String printerNewline) {
+    super(delimiter, encapsulator, commentStart, escape,
+        ignoreLeadingWhitespaces, ignoreTrailingWhitespaces,
+        interpretUnicodeEscapes, ignoreEmptyLines,
+        printerNewline);
+  }
+  @Override
+  public void setDelimiter(char delimiter) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setEncapsulator(char encapsulator) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setCommentStart(char commentStart) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setEscape(char escape) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setIgnoreLeadingWhitespaces(boolean ignoreLeadingWhitespaces) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setIgnoreTrailingWhitespaces(boolean ignoreTrailingWhitespaces) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setUnicodeEscapeInterpretation(boolean interpretUnicodeEscapes) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setIgnoreEmptyLines(boolean ignoreEmptyLines) {
+    throw new UnsupportedOperationException();
+  }
+  @Override
+  public void setPrinterNewline(String newline) {
+    throw new UnsupportedOperationException();
+  }
+
+  /** Returns a mutable clone */
+  @Override
+  public Object clone() {
+    return new CSVStrategy(getDelimiter(), getEncapsulator(), getCommentStart(), getEscape(),
+        getIgnoreLeadingWhitespaces(), getIgnoreTrailingWhitespaces(),
+        getUnicodeEscapeInterpretation(), getIgnoreEmptyLines(),
+        getPrinterNewline());
+  }
 }

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb0c3bd9/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java b/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
index 816e0e0..ba77821 100644
--- a/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
@@ -179,7 +179,8 @@ class CSVWriter extends TextResponseWriter {
   public void writeResponse() throws IOException {
     SolrParams params = req.getParams();
 
-    strategy = new CSVStrategy(',', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED,
false, false, false, true);
+    strategy = new CSVStrategy
+        (',', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED, false, false,
false, true, "\n");
     CSVStrategy strat = strategy;
 
     String sep = params.get(CSV_SEPARATOR);
@@ -218,7 +219,8 @@ class CSVWriter extends TextResponseWriter {
     printer = new CSVPrinter(writer, strategy);
     
 
-    CSVStrategy mvStrategy = new CSVStrategy(strategy.getDelimiter(), CSVStrategy.ENCAPSULATOR_DISABLED,
CSVStrategy.COMMENTS_DISABLED, '\\', false, false, false, false);
+    CSVStrategy mvStrategy = new CSVStrategy(strategy.getDelimiter(), CSVStrategy.ENCAPSULATOR_DISABLED,

+        CSVStrategy.COMMENTS_DISABLED, '\\', false, false, false, false, "\n");
     strat = mvStrategy;
 
     sep = params.get(MV_SEPARATOR);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb0c3bd9/solr/core/src/test/org/apache/solr/internal/csv/CSVParserTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/internal/csv/CSVParserTest.java b/solr/core/src/test/org/apache/solr/internal/csv/CSVParserTest.java
index 54b0c61..0688c52 100644
--- a/solr/core/src/test/org/apache/solr/internal/csv/CSVParserTest.java
+++ b/solr/core/src/test/org/apache/solr/internal/csv/CSVParserTest.java
@@ -446,7 +446,7 @@ public class CSVParserTest extends TestCase {
       };
 
 
-    CSVStrategy strategy = new CSVStrategy(',','\'',CSVStrategy.COMMENTS_DISABLED,'/',false,false,true,true);
+    CSVStrategy strategy = new CSVStrategy(',','\'',CSVStrategy.COMMENTS_DISABLED,'/',false,false,true,true,"\n");
 
     CSVParser parser = new CSVParser(new StringReader(code), strategy);
     String[][] tmp = parser.getAllValues();
@@ -474,7 +474,8 @@ public class CSVParserTest extends TestCase {
       };
 
 
-    CSVStrategy strategy = new CSVStrategy(',',CSVStrategy.ENCAPSULATOR_DISABLED,CSVStrategy.COMMENTS_DISABLED,'/',false,false,true,true);
+    CSVStrategy strategy = new CSVStrategy
+        (',', CSVStrategy.ENCAPSULATOR_DISABLED, CSVStrategy.COMMENTS_DISABLED, '/', false,
false, true, true, "\n");
 
     CSVParser parser = new CSVParser(new StringReader(code), strategy);
     String[][] tmp = parser.getAllValues();
@@ -529,8 +530,9 @@ public class CSVParserTest extends TestCase {
 
     public void testUnicodeEscape() throws IOException {
       String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063";
-      CSVParser parser = new CSVParser(new StringReader(code));
-      parser.getStrategy().setUnicodeEscapeInterpretation(true);
+      CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
+      strategy.setUnicodeEscapeInterpretation(true);
+      CSVParser parser = new CSVParser(new StringReader(code), strategy);
       String[] data = parser.getLine();
       assertEquals(2, data.length);
       assertEquals("abc", data[0]);

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/eb0c3bd9/solr/core/src/test/org/apache/solr/internal/csv/CSVPrinterTest.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/internal/csv/CSVPrinterTest.java b/solr/core/src/test/org/apache/solr/internal/csv/CSVPrinterTest.java
index 6a9a819..a141efb 100644
--- a/solr/core/src/test/org/apache/solr/internal/csv/CSVPrinterTest.java
+++ b/solr/core/src/test/org/apache/solr/internal/csv/CSVPrinterTest.java
@@ -83,7 +83,8 @@ public class CSVPrinterTest extends TestCase {
     doRandom(iter);
 
     // Strategy for MySQL
-    strategy = new CSVStrategy('\t', CSVStrategy.ENCAPSULATOR_DISABLED, CSVStrategy.COMMENTS_DISABLED,'\\',false,
false, false, false);
+    strategy = new CSVStrategy
+        ('\t', CSVStrategy.ENCAPSULATOR_DISABLED, CSVStrategy.COMMENTS_DISABLED,'\\',false,
false, false, false, "\n");
     doRandom(iter);
   }
 


Mime
View raw message