Skip to content

Commit

Permalink
Preparing to release version 2.9.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jbax committed Aug 15, 2020
1 parent 70b2e71 commit f392311
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.univocity</groupId>
<artifactId>univocity-parsers</artifactId>
<version>2.8.5-SNAPSHOT</version>
<version>2.9.0</version>
<name>univocity-parsers</name>
<packaging>jar</packaging>
<description>univocity's open source parsers for processing different text formats using a consistent API</description>
Expand Down
28 changes: 11 additions & 17 deletions src/main/java/com/univocity/parsers/common/AbstractParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 74,7 @@ public abstract class AbstractParser<T extends CommonParserSettings<?>> {
protected boolean ignoreTrailingWhitespace;
protected boolean ignoreLeadingWhitespace;

private final boolean commentLineCheck;
private final boolean processComments;

/**
* All parsers must support, at the very least, the settings provided by {@link CommonParserSettings}. The AbstractParser requires its configuration to be
Expand All @@ -98,7 98,7 @@ public AbstractParser(T settings) {
this.comments = collectComments ? new TreeMap<Long, String>() : Collections.<Long, String>emptyMap();
this.extractHeaders = settings.isHeaderExtractionEnabled();
this.whitespaceRangeStart = settings.getWhitespaceRangeStart();
this.commentLineCheck = settings.isCommentLineCheckEnabled();
this.processComments = settings.isCommentProcessingEnabled();
}

protected void processComment() {
Expand Down Expand Up @@ -130,11 130,9 @@ public final void parse(Reader reader) {
while (!context.isStopped()) {
input.markRecordStart();
ch = input.nextChar();
if(commentLineCheck) {
if (inComment()) {
processComment();
continue;
}
if (processComments && inComment()) {
processComment();
continue;
}

if (output.pendingRecords.isEmpty()) {
Expand Down Expand Up @@ -571,11 569,9 @@ public final String[] parseNext() {
while (!context.isStopped()) {
input.markRecordStart();
ch = input.nextChar();
if(commentLineCheck) {
if (inComment()) {
processComment();
continue;
}
if (processComments && inComment()) {
processComment();
continue;
}
if (output.pendingRecords.isEmpty()) {
parseRecord();
Expand Down Expand Up @@ -679,11 675,9 @@ public final String[] parseLine(String line) {
while (!context.isStopped()) {
input.markRecordStart();
ch = input.nextChar();
if(commentLineCheck) {
if (inComment()) {
processComment();
return null;
}
if (processComments && inComment()) {
processComment();
return null;
}
if (output.pendingRecords.isEmpty()) {
parseRecord();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 65,7 @@ public abstract class CommonParserSettings<F extends Format> extends CommonSetti
private long numberOfRowsToSkip = 0L;
private boolean commentCollectionEnabled = false;
private boolean autoClosingEnabled = true;
private boolean commentLineCheckEnabled = true;
private boolean commentProcessingEnabled = true;
/**
* Indicates whether or not a separate thread will be used to read characters from the input while parsing (defaults true if the number of available
* processors at runtime is greater than 1)
Expand Down Expand Up @@ -504,20 504,20 @@ public void setAutoClosingEnabled(boolean autoClosingEnabled) {
* If disabled/false then parser wont treat any line as comment line including default(#)
* this condition will supersede the comment character(#)
*/
public boolean isCommentLineCheckEnabled() {
return commentLineCheckEnabled;
public boolean isCommentProcessingEnabled() {
return commentProcessingEnabled;
}

/**
* Configures whether the parser will check for the comment line in the file
* Defaults to {@code true}
*
* @param commentLineCheckEnabled flag determining whether comment line check should be performed
* @param commentProcessingEnabled flag determining whether comment line check should be performed
*If disabled/false then parser wont treat any line as comment line including default(#)
* this condition will supersede the comment character(#)
*/
public void setCommentLineCheckEnabled(boolean commentLineCheckEnabled) {
this.commentLineCheckEnabled = commentLineCheckEnabled;
public void setCommentProcessingEnabled(boolean commentProcessingEnabled) {
this.commentProcessingEnabled = commentProcessingEnabled;
}

}
2 changes: 1 addition & 1 deletion src/test/java/com/univocity/parsers/csv/CsvParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -872,7 872,7 @@ public void parseDisablingCommentLineCheck(String csvFile, char[] lineSeparator)
CsvParserSettings settings = newCsvInputSettings(lineSeparator);
settings.setCommentCollectionEnabled(true);
settings.setRowProcessor(processor);
settings.setCommentLineCheckEnabled(false);
settings.setCommentProcessingEnabled(false);
settings.setHeaderExtractionEnabled(true);
settings.setIgnoreLeadingWhitespaces(true);
settings.setIgnoreTrailingWhitespaces(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 34,7 @@ public void testParsingLineWithEnableCommentLineCheckToFalse() {
format.setLineSeparator("\n");
format.setDelimiter(',');

s.setCommentLineCheckEnabled(false);
s.setCommentProcessingEnabled(false);
s.setIgnoreLeadingWhitespaces(true);
s.setIgnoreTrailingWhitespaces(true);
s.setNullValue("");
Expand Down

0 comments on commit f392311

Please sign in to comment.