You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2024/09/14 16:32:00 UTC

(commons-csv) branch master updated (afbeaed8 -> 4d07845a)

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

ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git


    from afbeaed8 [CSV-150] Add disabled test JiraCsv150Test
     new 28acf113 CSVFormat does not support explicit " as escape char
     new a6814bad [CSV-270] Throw a different Expeciton type on malformed CSV input
     new 4d07845a [CSV-150] Escaping is not disableable

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/changes/changes.xml                                |  3 ++-
 src/main/java/org/apache/commons/csv/Lexer.java        | 18 ++++++------------
 .../org/apache/commons/csv/issues/JiraCsv150Test.java  |  2 --
 3 files changed, 8 insertions(+), 15 deletions(-)


(commons-csv) 03/03: [CSV-150] Escaping is not disableable

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit 4d07845a95b8adf619297b1e4215f36414b9b57a
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 14 12:31:55 2024 -0400

    [CSV-150] Escaping is not disableable
---
 src/changes/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index d2f7176a..fa5605ea 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,7 +50,7 @@
       <action type="fix" dev="ggregory" due-to="Dávid Szigecsán">Migrate CSVFormat#print(File, Charset) to NIO #445.</action>
       <action type="fix" dev="ggregory" due-to="Dávid Szigecsán">Fix documentation for CSVFormat private constructor #466.</action>
       <action type="fix" issue="CSV-294" dev="ggregory" due-to="Joern Huxhorn, Gary Gregory">CSVFormat does not support explicit " as escape char.</action>
-      <action type="fix" issue="CSV-150" dev="ggregory" due-to="dota17, Gary Gregory, Jörn Huxhorn">CSVFormat does not support explicit " as escape char.</action>
+      <action type="fix" issue="CSV-150" dev="ggregory" due-to="dota17, Gary Gregory, Jörn Huxhorn">Escaping is not disableable.</action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">Bump commons-codec:commons-codec from 1.16.1 to 1.17.1 #422, #449.</action>
       <action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 69 to 74 #435, #452, #465, #468.</action>


(commons-csv) 01/03: CSVFormat does not support explicit " as escape char

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit 28acf1138b64c889a520c190464ad1d16862dd41
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 14 12:30:15 2024 -0400

    CSVFormat does not support explicit " as escape char
---
 src/changes/changes.xml                                |  1 +
 src/main/java/org/apache/commons/csv/Lexer.java        | 18 ++++++------------
 .../org/apache/commons/csv/issues/JiraCsv150Test.java  |  2 --
 3 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 1fdf448e..e1cb2553 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -50,6 +50,7 @@
       <action type="fix" dev="ggregory" due-to="Dávid Szigecsán">Migrate CSVFormat#print(File, Charset) to NIO #445.</action>
       <action type="fix" dev="ggregory" due-to="Dávid Szigecsán">Fix documentation for CSVFormat private constructor #466.</action>
       <action type="fix" issue="CSV-294" dev="ggregory" due-to="Joern Huxhorn, Gary Gregory">CSVFormat does not support explicit " as escape char.</action>
+      <action type="fix" issue="CSV-150" dev="ggregory" due-to="dota17, Gary Gregory, Jörn Huxhorn">CSVFormat does not support explicit " as escape char.</action>
       <!-- UPDATE -->
       <action type="update" dev="ggregory" due-to="Dependabot">Bump commons-codec:commons-codec from 1.16.1 to 1.17.1 #422, #449.</action>
       <action type="update" dev="ggregory" due-to="Gary Gregory">Bump org.apache.commons:commons-parent from 69 to 74 #435, #452, #465, #468.</action>
diff --git a/src/main/java/org/apache/commons/csv/Lexer.java b/src/main/java/org/apache/commons/csv/Lexer.java
index e2aec718..489166f7 100644
--- a/src/main/java/org/apache/commons/csv/Lexer.java
+++ b/src/main/java/org/apache/commons/csv/Lexer.java
@@ -32,19 +32,12 @@ final class Lexer implements Closeable {
     private static final String CR_STRING = Character.toString(Constants.CR);
     private static final String LF_STRING = Character.toString(Constants.LF);
 
-    /**
-     * Constant char to use for disabling comments, escapes, and encapsulation. The value -2 is used because it
-     * won't be confused with an EOF signal (-1), and because the Unicode value {@code FFFE} would be encoded as two
-     * chars (using surrogates) and thus there should never be a collision with a real text char.
-     */
-    private static final char DISABLED = '\ufffe';
-
     private final char[] delimiter;
     private final char[] delimiterBuf;
     private final char[] escapeDelimiterBuf;
-    private final char escape;
-    private final char quoteChar;
-    private final char commentStart;
+    private final int escape;
+    private final int quoteChar;
+    private final int commentStart;
     private final boolean ignoreSurroundingSpaces;
     private final boolean ignoreEmptyLines;
     private final boolean lenientEof;
@@ -197,8 +190,8 @@ final class Lexer implements Closeable {
         return ch == Constants.LF || ch == Constants.CR || ch == Constants.UNDEFINED;
     }
 
-    private char mapNullToDisabled(final Character c) {
-        return c == null ? DISABLED : c.charValue(); // N.B. Explicit (un)boxing is intentional
+    private int mapNullToDisabled(final Character c) {
+        return c == null ? -1 : c.charValue(); // Explicit unboxing is intentional
     }
 
     /**
@@ -512,4 +505,5 @@ final class Lexer implements Closeable {
             buffer.setLength(length);
         }
     }
+
 }
diff --git a/src/test/java/org/apache/commons/csv/issues/JiraCsv150Test.java b/src/test/java/org/apache/commons/csv/issues/JiraCsv150Test.java
index 415fe296..1ede9f23 100644
--- a/src/test/java/org/apache/commons/csv/issues/JiraCsv150Test.java
+++ b/src/test/java/org/apache/commons/csv/issues/JiraCsv150Test.java
@@ -23,10 +23,8 @@ import java.io.StringReader;
 
 import org.apache.commons.csv.CSVFormat;
 import org.apache.commons.csv.CSVParser;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 
-@Disabled
 public class JiraCsv150Test {
 
     private void testDisable(final CSVFormat csvFormat, final StringReader stringReader) throws IOException {


(commons-csv) 02/03: [CSV-270] Throw a different Expeciton type on malformed CSV input

Posted by gg...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit a6814bad5c658d831bfad163f5724f24d837c387
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sat Sep 14 12:30:53 2024 -0400

    [CSV-270] Throw a different Expeciton type on malformed CSV input
---
 src/changes/changes.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index e1cb2553..d2f7176a 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -42,7 +42,7 @@
   <body>
     <release version="1.12.0" date="YYYY-MM-DD" description="Feature and bug fix release (Java 8 or above)">
       <!-- ADD -->
-      <action type="add" issue="CSV-270" dev="ggregory" due-to="Gary Gregory">Add CSVException that extends IOException thrown on invalid input instead of IOException.</action>
+      <action type="add" issue="CSV-270" dev="ggregory" due-to="Thomas Kamps, Gary Gregory">Add CSVException that extends IOException thrown on invalid input instead of IOException.</action>
       <!-- FIX -->
       <action type="fix" dev="ggregory" due-to="Gary Gregory">Fix PMD issues for port to PMD 7.1.0.</action>
       <action type="fix" dev="ggregory" due-to="Dávid Szigecsán, Gary Gregory">Fix some Javadoc links #442.</action>