Author: britter
Date: Mon Jul 14 19:34:56 2014
New Revision: 1610494
URL: http://svn.apache.org/r1610494
Log:
Rename withCommentStart to withCommentMarker to avoid confusion because there
is no corresponding withCommentStop method
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/LexerTest.java
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1610494&r1=1610493&r2=1610494&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
(original)
+++
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Mon Jul 14 19:34:56 2014
@@ -745,14 +745,14 @@ public final class CSVFormat implements
*
* Note that the comment start character is only recognized at the start
of a line.
*
- * @param commentStart
+ * @param commentMarker
* the comment start marker
* @return A new CSVFormat that is equal to this one but with the
specified character as the comment start marker
* @throws IllegalArgumentException
* thrown if the specified character is a line break
*/
- public CSVFormat withCommentStart(final char commentStart) {
- return withCommentStart(Character.valueOf(commentStart));
+ public CSVFormat withCommentMarker(final char commentMarker) {
+ return withCommentMarker(Character.valueOf(commentMarker));
}
/**
@@ -760,17 +760,17 @@ public final class CSVFormat implements
*
* Note that the comment start character is only recognized at the start
of a line.
*
- * @param commentStart
+ * @param commentMarker
* the comment start marker, use {@code null} to disable
* @return A new CSVFormat that is equal to this one but with the
specified character as the comment start marker
* @throws IllegalArgumentException
* thrown if the specified character is a line break
*/
- public CSVFormat withCommentStart(final Character commentStart) {
- if (isLineBreak(commentStart)) {
- throw new IllegalArgumentException("The comment start character
cannot be a line break");
+ public CSVFormat withCommentMarker(final Character commentMarker) {
+ if (isLineBreak(commentMarker)) {
+ throw new IllegalArgumentException("The comment start marker
character cannot be a line break");
}
- return new CSVFormat(delimiter, quoteChar, quotePolicy, commentStart,
escape,
+ return new CSVFormat(delimiter, quoteChar, quotePolicy, commentMarker,
escape,
ignoreSurroundingSpaces, ignoreEmptyLines, recordSeparator,
nullString, header, skipHeaderRecord,
ignoreEmptyHeaders);
}
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java?rev=1610494&r1=1610493&r2=1610494&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFileParserTest.java
Mon Jul 14 19:34:56 2014
@@ -100,7 +100,7 @@ public class CSVFileParserTest {
} else if ("IgnoreSpaces".equalsIgnoreCase(option_parts[0])) {
format =
format.withIgnoreSurroundingSpaces(Boolean.parseBoolean(option_parts[1]));
} else if ("CommentStart".equalsIgnoreCase(option_parts[0])) {
- format = format.withCommentStart(option_parts[1].charAt(0));
+ format = format.withCommentMarker(option_parts[1].charAt(0));
} else if ("CheckComments".equalsIgnoreCase(option_parts[0])) {
checkComments = true;
} else {
@@ -144,7 +144,7 @@ public class CSVFileParserTest {
} else if ("IgnoreSpaces".equalsIgnoreCase(option_parts[0])) {
format =
format.withIgnoreSurroundingSpaces(Boolean.parseBoolean(option_parts[1]));
} else if ("CommentStart".equalsIgnoreCase(option_parts[0])) {
- format = format.withCommentStart(option_parts[1].charAt(0));
+ format = format.withCommentMarker(option_parts[1].charAt(0));
} else if ("CheckComments".equalsIgnoreCase(option_parts[0])) {
checkComments = true;
} else {
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java?rev=1610494&r1=1610493&r2=1610494&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVFormatTest.java
Mon Jul 14 19:34:56 2014
@@ -54,7 +54,7 @@ public class CSVFormatTest {
@Test(expected = IllegalArgumentException.class)
public void testDelimiterSameAsCommentStartThrowsException() {
- CSVFormat.DEFAULT.withDelimiter('!').withCommentStart('!');
+ CSVFormat.DEFAULT.withDelimiter('!').withCommentMarker('!');
}
@Test(expected = IllegalArgumentException.class)
@@ -87,10 +87,10 @@ public class CSVFormatTest {
public void testEqualsCommentStart() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withQuoteChar('"')
- .withCommentStart('#')
+ .withCommentMarker('#')
.withQuotePolicy(Quote.ALL);
final CSVFormat left = right
- .withCommentStart('!');
+ .withCommentMarker('!');
assertNotEquals(right, left);
}
@@ -107,7 +107,7 @@ public class CSVFormatTest {
public void testEqualsEscape() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withQuoteChar('"')
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withQuotePolicy(Quote.ALL);
final CSVFormat left = right
@@ -120,7 +120,7 @@ public class CSVFormatTest {
public void testEqualsHeader() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withRecordSeparator(CR)
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withHeader("One", "Two", "Three")
.withIgnoreEmptyLines(true)
@@ -136,7 +136,7 @@ public class CSVFormatTest {
@Test
public void testEqualsIgnoreEmptyLines() {
final CSVFormat right = CSVFormat.newFormat('\'')
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withIgnoreEmptyLines(true)
.withIgnoreSurroundingSpaces(true)
@@ -151,7 +151,7 @@ public class CSVFormatTest {
@Test
public void testEqualsIgnoreSurroundingSpaces() {
final CSVFormat right = CSVFormat.newFormat('\'')
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withIgnoreSurroundingSpaces(true)
.withQuoteChar('"')
@@ -185,7 +185,7 @@ public class CSVFormatTest {
public void testEqualsRecordSeparator() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withRecordSeparator(CR)
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withIgnoreEmptyLines(true)
.withIgnoreSurroundingSpaces(true)
@@ -201,7 +201,7 @@ public class CSVFormatTest {
public void testEqualsNullString() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withRecordSeparator(CR)
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withIgnoreEmptyLines(true)
.withIgnoreSurroundingSpaces(true)
@@ -218,7 +218,7 @@ public class CSVFormatTest {
public void testEqualsSkipHeaderRecord() {
final CSVFormat right = CSVFormat.newFormat('\'')
.withRecordSeparator(CR)
- .withCommentStart('#')
+ .withCommentMarker('#')
.withEscape('+')
.withIgnoreEmptyLines(true)
.withIgnoreSurroundingSpaces(true)
@@ -234,13 +234,13 @@ public class CSVFormatTest {
@Test(expected = IllegalArgumentException.class)
public void testEscapeSameAsCommentStartThrowsException() {
- CSVFormat.DEFAULT.withEscape('!').withCommentStart('!');
+ CSVFormat.DEFAULT.withEscape('!').withCommentMarker('!');
}
@Test(expected = IllegalArgumentException.class)
public void testEscapeSameAsCommentStartThrowsExceptionForWrapperType() {
// Cannot assume that callers won't use different Character objects
- CSVFormat.DEFAULT.withEscape(new Character('!')).withCommentStart(new
Character('!'));
+ CSVFormat.DEFAULT.withEscape(new Character('!')).withCommentMarker(new
Character('!'));
}
@Test
@@ -275,13 +275,13 @@ public class CSVFormatTest {
@Test(expected = IllegalArgumentException.class)
public void testQuoteCharSameAsCommentStartThrowsException() {
- CSVFormat.DEFAULT.withQuoteChar('!').withCommentStart('!');
+ CSVFormat.DEFAULT.withQuoteChar('!').withCommentMarker('!');
}
@Test(expected = IllegalArgumentException.class)
public void testQuoteCharSameAsCommentStartThrowsExceptionForWrapperType()
{
// Cannot assume that callers won't use different Character objects
- CSVFormat.DEFAULT.withQuoteChar(new
Character('!')).withCommentStart('!');
+ CSVFormat.DEFAULT.withQuoteChar(new
Character('!')).withCommentMarker('!');
}
@Test(expected = IllegalArgumentException.class)
@@ -330,13 +330,13 @@ public class CSVFormatTest {
@Test
public void testWithCommentStart() throws Exception {
- final CSVFormat formatWithCommentStart =
CSVFormat.DEFAULT.withCommentStart('#');
+ final CSVFormat formatWithCommentStart =
CSVFormat.DEFAULT.withCommentMarker('#');
assertEquals( Character.valueOf('#'),
formatWithCommentStart.getCommentStart());
}
@Test(expected = IllegalArgumentException.class)
public void testWithCommentStartCRThrowsException() {
- CSVFormat.DEFAULT.withCommentStart(CR);
+ CSVFormat.DEFAULT.withCommentMarker(CR);
}
@Test
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java?rev=1610494&r1=1610493&r2=1610494&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVParserTest.java
Mon Jul 14 19:34:56 2014
@@ -242,7 +242,7 @@ public class CSVParserTest {
@Test(expected = NoSuchElementException.class)
public void testClose() throws Exception {
final Reader in = new StringReader("# comment\na,b,c\n1,2,3\nx,y,z");
- final CSVParser parser =
CSVFormat.DEFAULT.withCommentStart('#').withHeader().parse(in);
+ final CSVParser parser =
CSVFormat.DEFAULT.withCommentMarker('#').withHeader().parse(in);
final Iterator<CSVRecord> records = parser.iterator();
assertTrue(records.hasNext());
parser.close();
@@ -288,7 +288,7 @@ public class CSVParserTest {
{"\n", " ", "#"},
};
- format = CSVFormat.DEFAULT.withCommentStart('#');
+ format = CSVFormat.DEFAULT.withCommentMarker('#');
parser.close();
parser = CSVParser.parse(code, format);
records = parser.getRecords();
@@ -671,7 +671,7 @@ public class CSVParserTest {
public void testHeaderComment() throws Exception {
final Reader in = new StringReader("# comment\na,b,c\n1,2,3\nx,y,z");
- final Iterator<CSVRecord> records =
CSVFormat.DEFAULT.withCommentStart('#').withHeader().parse(in).iterator();
+ final Iterator<CSVRecord> records =
CSVFormat.DEFAULT.withCommentMarker('#').withHeader().parse(in).iterator();
for (int i = 0; i < 2; i++) {
assertTrue(records.hasNext());
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java?rev=1610494&r1=1610493&r2=1610494&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/CSVPrinterTest.java
Mon Jul 14 19:34:56 2014
@@ -233,7 +233,7 @@ public class CSVPrinterTest {
@Test
public void testMultiLineComment() throws IOException {
final StringWriter sw = new StringWriter();
- final CSVPrinter printer = new CSVPrinter(sw,
CSVFormat.DEFAULT.withCommentStart('#'));
+ final CSVPrinter printer = new CSVPrinter(sw,
CSVFormat.DEFAULT.withCommentMarker('#'));
printer.printComment("This is a comment\non multiple lines");
assertEquals("# This is a comment" + recordSeparator + "# on multiple
lines" + recordSeparator, sw.toString());
@@ -387,7 +387,7 @@ public class CSVPrinterTest {
@Test
public void testSingleLineComment() throws IOException {
final StringWriter sw = new StringWriter();
- final CSVPrinter printer = new CSVPrinter(sw,
CSVFormat.DEFAULT.withCommentStart('#'));
+ final CSVPrinter printer = new CSVPrinter(sw,
CSVFormat.DEFAULT.withCommentMarker('#'));
printer.printComment("This is a comment");
assertEquals("# This is a comment" + recordSeparator, sw.toString());
Modified:
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/LexerTest.java
URL:
http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/LexerTest.java?rev=1610494&r1=1610493&r2=1610494&view=diff
==============================================================================
---
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/LexerTest.java
(original)
+++
commons/proper/csv/trunk/src/test/java/org/apache/commons/csv/LexerTest.java
Mon Jul 14 19:34:56 2014
@@ -122,7 +122,7 @@ public class LexerTest {
"third,line,#no-comment\n"+
"# penultimate comment\n"+
"# Final comment\n";
- final CSVFormat format = CSVFormat.DEFAULT.withCommentStart('#');
+ final CSVFormat format = CSVFormat.DEFAULT.withCommentMarker('#');
final Lexer parser = getLexer(code, format);
assertThat(parser.nextToken(new Token()), matches(TOKEN, "first"));
@@ -158,7 +158,7 @@ public class LexerTest {
"\n"+ // 6b
"\n"+ // 6c
"# Final comment\n"; // 7
- final CSVFormat format =
CSVFormat.DEFAULT.withCommentStart('#').withIgnoreEmptyLines(false);
+ final CSVFormat format =
CSVFormat.DEFAULT.withCommentMarker('#').withIgnoreEmptyLines(false);
assertFalse("Should not ignore empty lines",
format.isIgnoringEmptyLines());
final Lexer parser = getLexer(code, format);
@@ -279,7 +279,7 @@ public class LexerTest {
* ;;
*/
final String code = "a;'b and '' more\n'\n!comment;;;;\n;;";
- final CSVFormat format =
CSVFormat.DEFAULT.withQuoteChar('\'').withCommentStart('!').withDelimiter(';');
+ final CSVFormat format =
CSVFormat.DEFAULT.withQuoteChar('\'').withCommentMarker('!').withDelimiter(';');
final Lexer parser = getLexer(code, format);
assertThat(parser.nextToken(new Token()), matches(TOKEN, "a"));
assertThat(parser.nextToken(new Token()), matches(EORECORD, "b and '
more\n"));