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

cpoerschke pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new 80936d1  SOLR-14279: remove CSVStrategy's deprecated setters (#480)
80936d1 is described below

commit 80936d1ac4eaade654a33332efe0f84bfe632d3e
Author: Christine Poerschke <[email protected]>
AuthorDate: Wed Jan 5 10:13:29 2022 +0000

    SOLR-14279: remove CSVStrategy's deprecated setters (#480)
---
 .../apache/solr/handler/loader/CSVLoaderBase.java  |  24 ++--
 .../org/apache/solr/internal/csv/CSVStrategy.java  | 157 ++-------------------
 .../apache/solr/response/CSVResponseWriter.java    |  66 +++++----
 .../apache/solr/internal/csv/CSVParserTest.java    |  13 +-
 .../apache/solr/internal/csv/CSVStrategyTest.java  |  27 ++--
 5 files changed, 81 insertions(+), 206 deletions(-)

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 2cc7662..6d337ff 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
@@ -166,45 +166,51 @@ public 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, "\n");
+    char delimiter = ',';
     String sep = params.get(SEPARATOR);
     if (sep!=null) {
       if (sep.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid separator:'"+sep+"'");
-      strategy.setDelimiter(sep.charAt(0));
+      delimiter = sep.charAt(0);
     }
 
+    char encapsulatorChar = '"';
     String encapsulator = params.get(ENCAPSULATOR);
     if (encapsulator!=null) {
       if (encapsulator.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid encapsulator:'"+encapsulator+"'");
     }
 
+    char escapeChar = CSVStrategy.ESCAPE_DISABLED;
     String escape = params.get(ESCAPE);
     if (escape!=null) {
       if (escape.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid escape:'"+escape+"'");
     }
-    rowId = params.get(ROW_ID);
-    rowIdOffset = params.getInt(ROW_ID_OFFSET, 0);
 
+    boolean interpretUnicodeEscapes = false;
     // if only encapsulator or escape is set, disable the other escaping 
mechanism
     if (encapsulator == null && escape != null) {
-      strategy.setEncapsulator( CSVStrategy.ENCAPSULATOR_DISABLED);     
-      strategy.setEscape(escape.charAt(0));
+      encapsulatorChar = CSVStrategy.ENCAPSULATOR_DISABLED;
+      escapeChar = escape.charAt(0);
     } else {
       if (encapsulator != null) {
-        strategy.setEncapsulator(encapsulator.charAt(0));
+        encapsulatorChar = encapsulator.charAt(0);
       }
       if (escape != null) {
         char ch = escape.charAt(0);
-        strategy.setEscape(ch);
+        escapeChar = ch;
         if (ch == '\\') {
           // If the escape is the standard backslash, then also enable
           // unicode escapes (it's harmless since 'u' would not otherwise
           // be escaped.                    
-          strategy.setUnicodeEscapeInterpretation(true);
+          interpretUnicodeEscapes = true;
         }
       }
     }
 
+    strategy = new CSVStrategy(delimiter, encapsulatorChar, 
CSVStrategy.COMMENTS_DISABLED, escapeChar, false, false, 
interpretUnicodeEscapes, true, "\n");
+
+    rowId = params.get(ROW_ID);
+    rowIdOffset = params.getInt(ROW_ID_OFFSET, 0);
+
     String fn = params.get(FIELDNAMES);
     fieldnames = fn != null ? commaSplit.split(fn,-1) : null;
 
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 930bbe0..3412b1d 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
@@ -25,17 +25,17 @@ import java.io.Serializable;
  */
 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;
+  final private char delimiter;
+  final private char encapsulator;
+  final private char commentStart;
+  final private char escape;
+  final private boolean ignoreLeadingWhitespaces;
+  final private boolean ignoreTrailingWhitespaces;
+  final private boolean interpretUnicodeEscapes;
+  final private boolean ignoreEmptyLines;
 
   // controls for output
-  private String printerNewline;
+  final 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
@@ -46,11 +46,11 @@ public class CSVStrategy implements Cloneable, Serializable 
{
   public static char ENCAPSULATOR_DISABLED   = (char)-2;
   public static String DEFAULT_PRINTER_NEWLINE = "\n";
 
-  public static final CSVStrategy DEFAULT_STRATEGY = new ImmutableCSVStrategy
+  public static final CSVStrategy DEFAULT_STRATEGY = new CSVStrategy
       (',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true, 
DEFAULT_PRINTER_NEWLINE);
-  public static final CSVStrategy EXCEL_STRATEGY = new ImmutableCSVStrategy
+  public static final CSVStrategy EXCEL_STRATEGY = new CSVStrategy
       (',', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, false, false, false, 
false, DEFAULT_PRINTER_NEWLINE);
-  public static final CSVStrategy TDF_STRATEGY = new ImmutableCSVStrategy
+  public static final CSVStrategy TDF_STRATEGY = new CSVStrategy
       ('\t', '"', COMMENTS_DISABLED, ESCAPE_DISABLED, true, true, false, true, 
DEFAULT_PRINTER_NEWLINE);
 
   public CSVStrategy(char delimiter, char encapsulator, char commentStart) {
@@ -88,158 +88,25 @@ public class CSVStrategy implements Cloneable, 
Serializable {
     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
-    }
-  }
-}
-
-/**
- * @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());
-  }
 }
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 f215581..7bf241b 100644
--- a/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
+++ b/solr/core/src/java/org/apache/solr/response/CSVResponseWriter.java
@@ -165,74 +165,82 @@ class CSVWriter extends TabularResponseWriter {
   public void writeResponse() throws IOException {
     SolrParams params = req.getParams();
 
-    strategy = new CSVStrategy
-        (',', '"', CSVStrategy.COMMENTS_DISABLED, CSVStrategy.ESCAPE_DISABLED, 
false, false, false, true, "\n");
-    CSVStrategy strat = strategy;
-
+    char delimiter = ',';
     String sep = params.get(CSV_SEPARATOR);
     if (sep!=null) {
       if (sep.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid separator:'"+sep+"'");
-      strat.setDelimiter(sep.charAt(0));
+      delimiter = sep.charAt(0);
     }
 
+    String printerNewline = "\n";
     String nl = params.get(CSV_NEWLINE);
     if (nl!=null) {
       if (nl.length()==0) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid newline:'"+nl+"'");
-      strat.setPrinterNewline(nl);
+      printerNewline = nl;
     }
 
     String encapsulator = params.get(CSV_ENCAPSULATOR);
     String escape = params.get(CSV_ESCAPE);
+
+    char encapsulatorChar = '"';
     if (encapsulator!=null) {
       if (encapsulator.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid encapsulator:'"+encapsulator+"'");
-      strat.setEncapsulator(encapsulator.charAt(0));
+      encapsulatorChar = encapsulator.charAt(0);
     }
 
+    char escapeChar = CSVStrategy.ESCAPE_DISABLED;
     if (escape!=null) {
       if (escape.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid escape:'"+escape+"'");
-      strat.setEscape(escape.charAt(0));
+      escapeChar = escape.charAt(0);
       if (encapsulator == null) {
-        strat.setEncapsulator( CSVStrategy.ENCAPSULATOR_DISABLED);
+        encapsulatorChar = CSVStrategy.ENCAPSULATOR_DISABLED;
       }
     }
 
-    if (strat.getEscape() == '\\') {
+    boolean interpretUnicodeEscapes = false;
+    if (escapeChar == '\\') {
       // If the escape is the standard backslash, then also enable
       // unicode escapes (it's harmless since 'u' would not otherwise
       // be escaped.
-      strat.setUnicodeEscapeInterpretation(true);
+      interpretUnicodeEscapes = true;
     }
-    printer = new CSVPrinter(writer, strategy);
-    
 
-    CSVStrategy mvStrategy = new CSVStrategy(strategy.getDelimiter(), 
CSVStrategy.ENCAPSULATOR_DISABLED, 
-        CSVStrategy.COMMENTS_DISABLED, '\\', false, false, false, false, "\n");
-    strat = mvStrategy;
+    strategy = new CSVStrategy
+        (delimiter, encapsulatorChar, CSVStrategy.COMMENTS_DISABLED, 
escapeChar, false, false, interpretUnicodeEscapes, true, printerNewline);
 
+    printer = new CSVPrinter(writer, strategy);
+
+    char mvStrategyDelimiter = strategy.getDelimiter();
     sep = params.get(MV_SEPARATOR);
     if (sep!=null) {
       if (sep.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid mv separator:'"+sep+"'");
-      strat.setDelimiter(sep.charAt(0));
+      mvStrategyDelimiter = sep.charAt(0);
     }
 
     encapsulator = params.get(MV_ENCAPSULATOR);
     escape = params.get(MV_ESCAPE);
 
+    char mvStrategyEncapsulatorChar = CSVStrategy.ENCAPSULATOR_DISABLED;
+    char mvStrategyEscape = '\\';
+
     if (encapsulator!=null) {
       if (encapsulator.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid mv 
encapsulator:'"+encapsulator+"'");
-      strat.setEncapsulator(encapsulator.charAt(0));
+      mvStrategyEncapsulatorChar = encapsulator.charAt(0);
       if (escape == null) {
-        strat.setEscape(CSVStrategy.ESCAPE_DISABLED);
+        mvStrategyEscape = CSVStrategy.ESCAPE_DISABLED;
       }
     }
 
     escape = params.get(MV_ESCAPE);
     if (escape!=null) {
       if (escape.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid mv escape:'"+escape+"'");
-      strat.setEscape(escape.charAt(0));
+      mvStrategyEscape = escape.charAt(0);
       // encapsulator will already be disabled if it wasn't specified
     }
 
+    CSVStrategy mvStrategy = new CSVStrategy(mvStrategyDelimiter, 
mvStrategyEncapsulatorChar,
+        CSVStrategy.COMMENTS_DISABLED, mvStrategyEscape, false, false, false, 
false, "\n");
+
     Collection<String> fields = getFields();
     CSVSharedBufPrinter csvPrinterMV = new CSVSharedBufPrinter(mvWriter, 
mvStrategy);
 
@@ -270,25 +278,31 @@ class CSVWriter extends TabularResponseWriter {
       CSVSharedBufPrinter csvPrinter = csvPrinterMV;
       if (sep != null || encapsulator != null || escape != null) {
         // create a new strategy + printer if there were any per-field 
overrides
-        strat = (CSVStrategy)mvStrategy.clone();
+        char fDelimiter = mvStrategy.getDelimiter();
+        char fEncapsulator = mvStrategy.getEncapsulator();
+        char fEscape = mvStrategy.getEscape();
         if (sep!=null) {
           if (sep.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid mv separator:'"+sep+"'");
-          strat.setDelimiter(sep.charAt(0));
+          fDelimiter = sep.charAt(0);
         }
         if (encapsulator!=null) {
           if (encapsulator.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid mv 
encapsulator:'"+encapsulator+"'");
-          strat.setEncapsulator(encapsulator.charAt(0));
+          fEncapsulator = encapsulator.charAt(0);
           if (escape == null) {
-            strat.setEscape(CSVStrategy.ESCAPE_DISABLED);
+            fEscape = CSVStrategy.ESCAPE_DISABLED;
           }
         }
         if (escape!=null) {
           if (escape.length()!=1) throw new SolrException( 
SolrException.ErrorCode.BAD_REQUEST,"Invalid mv escape:'"+escape+"'");
-          strat.setEscape(escape.charAt(0));
+          fEscape = escape.charAt(0);
           if (encapsulator == null) {
-            strat.setEncapsulator(CSVStrategy.ENCAPSULATOR_DISABLED);
+            fEncapsulator = CSVStrategy.ENCAPSULATOR_DISABLED;
           }
         }        
+        final CSVStrategy strat = new CSVStrategy(fDelimiter, fEncapsulator, 
mvStrategy.getCommentStart(), fEscape,
+            mvStrategy.getIgnoreLeadingWhitespaces(), 
mvStrategy.getIgnoreTrailingWhitespaces(),
+            mvStrategy.getUnicodeEscapeInterpretation(), 
mvStrategy.getIgnoreEmptyLines(),
+            mvStrategy.getPrinterNewline());
         csvPrinter = new CSVSharedBufPrinter(mvWriter, strat);
       }
 
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 ba604f8..e2a35c8 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
@@ -91,9 +91,8 @@ public class CSVParserTest extends TestCase {
      * 
      */
     String code = "1,2,3,\na,b x,c\n#foo\n\nd,e,\n\n";
-    CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
-    // strategy.setIgnoreEmptyLines(false);
-    strategy.setCommentStart('#');
+    CSVStrategy strategy = new CSVStrategy
+        (',', '"', '#', CSVStrategy.ESCAPE_DISABLED, true, true, false, true, 
CSVStrategy.DEFAULT_PRINTER_NEWLINE);
 
     TestCSVParser parser = new TestCSVParser(new StringReader(code), strategy);
 
@@ -120,8 +119,8 @@ public class CSVParserTest extends TestCase {
      *       \,,
      */
     String code = "a,\\,,b\n\\,,";
-    CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
-    strategy.setCommentStart('#');
+    CSVStrategy strategy = new CSVStrategy
+        (',', '"', '#', CSVStrategy.ESCAPE_DISABLED, true, true, false, true, 
CSVStrategy.DEFAULT_PRINTER_NEWLINE);
     TestCSVParser parser = new TestCSVParser(new StringReader(code), strategy);
 
     assertEquals(CSVParser.TT_TOKEN + ";a;", parser.testNextToken());
@@ -530,8 +529,8 @@ public class CSVParserTest extends TestCase {
 
     public void testUnicodeEscape() throws IOException {
       String code = "abc,\\u0070\\u0075\\u0062\\u006C\\u0069\\u0063";
-      CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
-      strategy.setUnicodeEscapeInterpretation(true);
+      CSVStrategy strategy = new CSVStrategy
+          (',', '"', CSVStrategy.COMMENTS_DISABLED, 
CSVStrategy.ESCAPE_DISABLED, true, true, true, true, 
CSVStrategy.DEFAULT_PRINTER_NEWLINE);
       CSVParser parser = new CSVParser(new StringReader(code), strategy);
       String[] data = parser.getLine();
       assertEquals(2, data.length);
diff --git 
a/solr/core/src/test/org/apache/solr/internal/csv/CSVStrategyTest.java 
b/solr/core/src/test/org/apache/solr/internal/csv/CSVStrategyTest.java
index 3a69821..19468af 100644
--- a/solr/core/src/test/org/apache/solr/internal/csv/CSVStrategyTest.java
+++ b/solr/core/src/test/org/apache/solr/internal/csv/CSVStrategyTest.java
@@ -30,32 +30,21 @@ import junit.framework.TestCase;
 public class CSVStrategyTest extends TestCase {
 
   // ======================================================
-  //   getters / setters
+  //   getters
   // ======================================================
-  public void testGetSetCommentStart() {
-    CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
-    strategy.setCommentStart('#');
-    assertEquals(strategy.getCommentStart(), '#');
-    strategy.setCommentStart('!');
-    assertEquals(strategy.getCommentStart(), '!');
+  public void testGetCommentStart() {
+    CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
+    assertEquals(strategy.getCommentStart(), CSVStrategy.COMMENTS_DISABLED);
   }
 
-  public void testGetSetEncapsulator() {
-    CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
-    strategy.setEncapsulator('"');
+  public void testGetEncapsulator() {
+    CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
     assertEquals(strategy.getEncapsulator(), '"');
-    strategy.setEncapsulator('\'');
-    assertEquals(strategy.getEncapsulator(), '\'');
   }
 
-  public void testGetSetDelimiter() {
-    CSVStrategy strategy = (CSVStrategy)CSVStrategy.DEFAULT_STRATEGY.clone();
-    strategy.setDelimiter(';');
-    assertEquals(strategy.getDelimiter(), ';');
-    strategy.setDelimiter(',');
+  public void testGetDelimiter() {
+    CSVStrategy strategy = CSVStrategy.DEFAULT_STRATEGY;
     assertEquals(strategy.getDelimiter(), ',');
-    strategy.setDelimiter('\t');
-    assertEquals(strategy.getDelimiter(), '\t');
   }
 
   public void testSetCSVStrategy() {

Reply via email to