You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "garydgregory (via GitHub)" <gi...@apache.org> on 2023/08/31 13:50:18 UTC

[GitHub] [commons-csv] garydgregory commented on a diff in pull request #347: [CSV-147] Error message optimization during faulty CSV record read

garydgregory commented on code in PR #347:
URL: https://github.com/apache/commons-csv/pull/347#discussion_r1311663575


##########
src/main/java/org/apache/commons/csv/CSVParser.java:
##########
@@ -765,7 +805,14 @@ CSVRecord nextRecord() throws IOException {
         final long startCharPosition = lexer.getCharacterPosition() + this.characterOffset;
         do {
             this.reusableToken.reset();
-            this.lexer.nextToken(this.reusableToken);
+            // https://issues.apache.org/jira/browse/CSV-147
+            try {
+                this.lexer.nextToken(this.reusableToken);
+            } catch (IOException ioe) {
+                String errorMessage = "An exception occurred while parsing the CSV content. Issue in line: "
+                        + this.lexer.getCurrentLineNumber() + ", position: " + this.lexer.getCharacterPosition();

Review Comment:
   Simply message: "Exception parsing at line N, column C."



##########
src/main/java/org/apache/commons/csv/CSVParser.java:
##########
@@ -765,7 +805,14 @@ CSVRecord nextRecord() throws IOException {
         final long startCharPosition = lexer.getCharacterPosition() + this.characterOffset;
         do {
             this.reusableToken.reset();
-            this.lexer.nextToken(this.reusableToken);
+            // https://issues.apache.org/jira/browse/CSV-147

Review Comment:
   No need for this comment IMO.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org