[jira] [Comment Edited] (CSV-141) Handle malformed CSV files

2022-12-26 Thread Damjan Jovanovic (Jira)


[ 
https://issues.apache.org/jira/browse/CSV-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17652125#comment-17652125
 ] 

Damjan Jovanovic edited comment on CSV-141 at 12/27/22 5:43 AM:


This kind of patch:
{code:java}
// code placeholder
diff --git a/src/main/java/org/apache/commons/csv/Lexer.java 
b/src/main/java/org/apache/commons/csv/Lexer.java
index fd60b5ac..177f56d6 100644
--- a/src/main/java/org/apache/commons/csv/Lexer.java
+++ b/src/main/java/org/apache/commons/csv/Lexer.java
@@ -378,9 +378,15 @@ final class Lexer implements Closeable {
                     }
                 }
             } else if (isEndOfFile(c)) {
-                // error condition (end of file before end of token)
-                throw new IOException("(startline " + startLineNumber +
-                        ") EOF reached before encapsulated token finished");
+                if (allowTrailingText) {
+                    token.type = EOF;
+                    token.isReady = true; // There is data at EOF
+                    return token;
+                } else {
+                    // error condition (end of file before end of token)
+                    throw new IOException("(startline " + startLineNumber +
+                            ") EOF reached before encapsulated token 
finished");
+                }
             } else {
                 // consume character
                 token.content.append((char) c); {code}
gets the EOF-implicitly-closes-encapsulated-field feature to work too, and 
successfully parses the CSV snippet in the original comment in the same way as 
Excel.

I am not sure whether this should be activated by the same flag 
(allowTrailingText) as my PR, or whether it should be a separate setting users 
can toggle on and off. [~ggregory]?


was (Author: damjan):
This kind of patch:
{code:java}
// code placeholder
diff --git a/src/main/java/org/apache/commons/csv/Lexer.java 
b/src/main/java/org/apache/commons/csv/Lexer.java
index fd60b5ac..177f56d6 100644
--- a/src/main/java/org/apache/commons/csv/Lexer.java
+++ b/src/main/java/org/apache/commons/csv/Lexer.java
@@ -378,9 +378,15 @@ final class Lexer implements Closeable {
                     }
                 }
             } else if (isEndOfFile(c)) {
-                // error condition (end of file before end of token)
-                throw new IOException("(startline " + startLineNumber +
-                        ") EOF reached before encapsulated token finished");
+                if (allowTrailingText) {
+                    token.type = EOF;
+                    token.isReady = true; // There is data at EOF
+                    return token;
+                } else {
+                    // error condition (end of file before end of token)
+                    throw new IOException("(startline " + startLineNumber +
+                            ") EOF reached before encapsulated token 
finished");
+                }
             } else {
                 // consume character
                 token.content.append((char) c); {code}
gets the EOF-implicitly-closes-unquoted-field feature to work too, and 
successfully parses the CSV snippet in the original comment in the same way as 
Excel.

I am not sure whether this should be activated by the same flag 
(allowTrailingText) as my PR, or whether it should be a separate setting users 
can toggle on and off. [~ggregory]?

> Handle malformed CSV files
> --
>
> Key: CSV-141
> URL: https://issues.apache.org/jira/browse/CSV-141
> Project: Commons CSV
>  Issue Type: Wish
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Nguyen Minh
>Priority: Minor
> Fix For: 1.x
>
>
> My java application has to handle thousands of CSV files uploaded by the 
> client phones everyday. So, there some CSV files have the wrong format which 
> I'm not sure why.
> Here is my sample CSV. Microsoft Excel parses it correctly, but both Common 
> CSV and OpenCSV can't parse it. Open CSV can't parse line 2 (due to '\' 
> character) and Common CSV will crash on line 3 and 4:
> "1414770317901","android.widget.EditText","pass sem1 _84*|*","0","pass sem1 
> _8"
> "1414770318470","android.widget.EditText","pass sem1 _84:*|*","0","pass sem1 
> _84:\"
> "1414770318327","android.widget.EditText","pass sem1 
> "1414770318628","android.widget.EditText","pass sem1 _84*|*","0","pass sem1
> Line 3: java.io.IOException: (line 5) invalid char between encapsulated token 
> and delimiter
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)
> Line 4: java.io.IOException: (startline 5) EOF reached before encapsulated 
> token finished
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   

[jira] [Commented] (CSV-141) Handle malformed CSV files

2022-12-26 Thread Damjan Jovanovic (Jira)


[ 
https://issues.apache.org/jira/browse/CSV-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17652125#comment-17652125
 ] 

Damjan Jovanovic commented on CSV-141:
--

This kind of patch:
{code:java}
// code placeholder
diff --git a/src/main/java/org/apache/commons/csv/Lexer.java 
b/src/main/java/org/apache/commons/csv/Lexer.java
index fd60b5ac..177f56d6 100644
--- a/src/main/java/org/apache/commons/csv/Lexer.java
+++ b/src/main/java/org/apache/commons/csv/Lexer.java
@@ -378,9 +378,15 @@ final class Lexer implements Closeable {
                     }
                 }
             } else if (isEndOfFile(c)) {
-                // error condition (end of file before end of token)
-                throw new IOException("(startline " + startLineNumber +
-                        ") EOF reached before encapsulated token finished");
+                if (allowTrailingText) {
+                    token.type = EOF;
+                    token.isReady = true; // There is data at EOF
+                    return token;
+                } else {
+                    // error condition (end of file before end of token)
+                    throw new IOException("(startline " + startLineNumber +
+                            ") EOF reached before encapsulated token 
finished");
+                }
             } else {
                 // consume character
                 token.content.append((char) c); {code}
gets the EOF-implicitly-closes-unquoted-field feature to work too, and 
successfully parses the CSV snippet in the original comment in the same way as 
Excel.

I am not sure whether this should be activated by the same flag 
(allowTrailingText) as my PR, or whether it should be a separate setting users 
can toggle on and off. [~ggregory]?

> Handle malformed CSV files
> --
>
> Key: CSV-141
> URL: https://issues.apache.org/jira/browse/CSV-141
> Project: Commons CSV
>  Issue Type: Wish
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Nguyen Minh
>Priority: Minor
> Fix For: 1.x
>
>
> My java application has to handle thousands of CSV files uploaded by the 
> client phones everyday. So, there some CSV files have the wrong format which 
> I'm not sure why.
> Here is my sample CSV. Microsoft Excel parses it correctly, but both Common 
> CSV and OpenCSV can't parse it. Open CSV can't parse line 2 (due to '\' 
> character) and Common CSV will crash on line 3 and 4:
> "1414770317901","android.widget.EditText","pass sem1 _84*|*","0","pass sem1 
> _8"
> "1414770318470","android.widget.EditText","pass sem1 _84:*|*","0","pass sem1 
> _84:\"
> "1414770318327","android.widget.EditText","pass sem1 
> "1414770318628","android.widget.EditText","pass sem1 _84*|*","0","pass sem1
> Line 3: java.io.IOException: (line 5) invalid char between encapsulated token 
> and delimiter
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)
> Line 4: java.io.IOException: (startline 5) EOF reached before encapsulated 
> token finished
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Commented] (CSV-141) Handle malformed CSV files

2022-12-26 Thread Damjan Jovanovic (Jira)


[ 
https://issues.apache.org/jira/browse/CSV-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17652116#comment-17652116
 ] 

Damjan Jovanovic commented on CSV-141:
--

I've made a patch for this and added a pull request at 
[https://github.com/apache/commons-csv/pull/295]

but now I see there's another problem with the CSV snippet in the original 
comment.

 

In Excel, a field with EOF before the closing quote:

a,"b

is acceptable, it becomes:

a,b

 

whereas in commons-csv, it's an error (EOF reached before encapsulated token 
finished), and in Apache OpenOffice, the entire line is silently lost.

This is something that should also be fixed, at least when using 
CSVFormat.EXCEL.

 

> Handle malformed CSV files
> --
>
> Key: CSV-141
> URL: https://issues.apache.org/jira/browse/CSV-141
> Project: Commons CSV
>  Issue Type: Wish
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Nguyen Minh
>Priority: Minor
> Fix For: 1.x
>
>
> My java application has to handle thousands of CSV files uploaded by the 
> client phones everyday. So, there some CSV files have the wrong format which 
> I'm not sure why.
> Here is my sample CSV. Microsoft Excel parses it correctly, but both Common 
> CSV and OpenCSV can't parse it. Open CSV can't parse line 2 (due to '\' 
> character) and Common CSV will crash on line 3 and 4:
> "1414770317901","android.widget.EditText","pass sem1 _84*|*","0","pass sem1 
> _8"
> "1414770318470","android.widget.EditText","pass sem1 _84:*|*","0","pass sem1 
> _84:\"
> "1414770318327","android.widget.EditText","pass sem1 
> "1414770318628","android.widget.EditText","pass sem1 _84*|*","0","pass sem1
> Line 3: java.io.IOException: (line 5) invalid char between encapsulated token 
> and delimiter
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)
> Line 4: java.io.IOException: (startline 5) EOF reached before encapsulated 
> token finished
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [commons-csv] DamjanJovanovic opened a new pull request, #295: Add support for trailing text after the closing quote, for Excel compatibility

2022-12-26 Thread GitBox


DamjanJovanovic opened a new pull request, #295:
URL: https://github.com/apache/commons-csv/pull/295

   As per issue https://issues.apache.org/jira/browse/CSV-141 and based on what 
we did in Apache OpenOffice https://bz.apache.org/ooo/show_bug.cgi?id=126805
   
   This adds a setting, allowTrailingText (for lack of a better name) that 
allows CSV fields to have trailing text after the closing quote, up to the next 
separator, which can contain anything except the separator character, and this 
extra text is appended as-is to the field contents (any further quoting is 
ignored). This is exactly how Excel behaves.
   
   As this is a non-standard setting with surprising behaviour, I've made it 
off by default. Only CSVFormat.EXCEL has it on by default.
   
   This doesn't fully fix CSV-141 yet as that has line ending issues too, but 
I'd like to investigate how Excel handles that first.


-- 
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-unsubscr...@commons.apache.org

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



[jira] [Commented] (CSV-141) Handle malformed CSV files

2022-12-26 Thread Damjan Jovanovic (Jira)


[ 
https://issues.apache.org/jira/browse/CSV-141?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17652083#comment-17652083
 ] 

Damjan Jovanovic commented on CSV-141:
--

[~nhatminh12369]  "But if I open the file on Microsoft Excel, or using OpenCSV 
to parse lines 3 and 4, they work fine."

Yes, in Apache OpenOffice we found a number of CSV files that open in Excel but 
not in OpenOffice, and eventually I patched OpenOffice to open them too. We 
should get commons-csv to do the same, at least when using CSVFormat.EXCEL.

Particularly see the discussion on 
[https://bz.apache.org/ooo/show_bug.cgi?id=126805]

What Excel allows, and what is very surprising if you don't know about it, is 
this: extra text after the closing quote and before the field separator, is 
allowed, and gets appended verbatim to the field contents. Any quoting in this 
extra text is ignored.

For example:

"a" and b => a and b

"a" "b" => a "b"

"a" "b => a "b

That's the basic issue in lines 3-4 in the sample posted here.

> Handle malformed CSV files
> --
>
> Key: CSV-141
> URL: https://issues.apache.org/jira/browse/CSV-141
> Project: Commons CSV
>  Issue Type: Wish
>  Components: Parser
>Affects Versions: 1.0
>Reporter: Nguyen Minh
>Priority: Minor
> Fix For: 1.x
>
>
> My java application has to handle thousands of CSV files uploaded by the 
> client phones everyday. So, there some CSV files have the wrong format which 
> I'm not sure why.
> Here is my sample CSV. Microsoft Excel parses it correctly, but both Common 
> CSV and OpenCSV can't parse it. Open CSV can't parse line 2 (due to '\' 
> character) and Common CSV will crash on line 3 and 4:
> "1414770317901","android.widget.EditText","pass sem1 _84*|*","0","pass sem1 
> _8"
> "1414770318470","android.widget.EditText","pass sem1 _84:*|*","0","pass sem1 
> _84:\"
> "1414770318327","android.widget.EditText","pass sem1 
> "1414770318628","android.widget.EditText","pass sem1 _84*|*","0","pass sem1
> Line 3: java.io.IOException: (line 5) invalid char between encapsulated token 
> and delimiter
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)
> Line 4: java.io.IOException: (startline 5) EOF reached before encapsulated 
> token finished
>   at org.apache.commons.csv.CSVParser$1.getNextRecord(CSVParser.java:398)
>   at org.apache.commons.csv.CSVParser$1.hasNext(CSVParser.java:407)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Work logged] (COLLECTIONS-806) Upgrade junit.framework.Test to org.junit.jupiter.api.Test

2022-12-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-806?focusedWorklogId=835703=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-835703
 ]

ASF GitHub Bot logged work on COLLECTIONS-806:
--

Author: ASF GitHub Bot
Created on: 26/Dec/22 21:25
Start Date: 26/Dec/22 21:25
Worklog Time Spent: 10m 
  Work Description: codecov-commenter commented on PR #371:
URL: 
https://github.com/apache/commons-collections/pull/371#issuecomment-1365467714

   # 
[Codecov](https://codecov.io/gh/apache/commons-collections/pull/371?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#371](https://codecov.io/gh/apache/commons-collections/pull/371?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (2f1b25a) into 
[master](https://codecov.io/gh/apache/commons-collections/commit/511d171516b8575a4aec55924ec39be64ccd6974?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (511d171) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@Coverage Diff@@
   ## master #371   +/-   ##
   =
 Coverage 81.19%   81.19%   
 Complexity 4604 4604   
   =
 Files   288  288   
 Lines 1342413424   
 Branches   1982 1982   
   =
 Hits  1090010900   
 Misses 1932 1932   
 Partials592  592   
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD 
build times. [Learn 
more](https://about.codecov.io/iterative-testing/?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   




Issue Time Tracking
---

Worklog Id: (was: 835703)
Time Spent: 2h 50m  (was: 2h 40m)

> Upgrade junit.framework.Test to org.junit.jupiter.api.Test
> --
>
> Key: COLLECTIONS-806
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-806
> Project: Commons Collections
>  Issue Type: Sub-task
>Reporter: John Patrick
>Priority: Major
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> Covers '57' usages of legacy usage of;
> {code:java}
> import junit.framework.Test;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [commons-collections] codecov-commenter commented on pull request #371: COLLECTIONS-806: removed references of JUnit4 Test class

2022-12-26 Thread GitBox


codecov-commenter commented on PR #371:
URL: 
https://github.com/apache/commons-collections/pull/371#issuecomment-1365467714

   # 
[Codecov](https://codecov.io/gh/apache/commons-collections/pull/371?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#371](https://codecov.io/gh/apache/commons-collections/pull/371?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (2f1b25a) into 
[master](https://codecov.io/gh/apache/commons-collections/commit/511d171516b8575a4aec55924ec39be64ccd6974?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (511d171) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@Coverage Diff@@
   ## master #371   +/-   ##
   =
 Coverage 81.19%   81.19%   
 Complexity 4604 4604   
   =
 Files   288  288   
 Lines 1342413424   
 Branches   1982 1982   
   =
 Hits  1090010900   
 Misses 1932 1932   
 Partials592  592   
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD 
build times. [Learn 
more](https://about.codecov.io/iterative-testing/?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   


-- 
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-unsubscr...@commons.apache.org

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



[jira] [Work logged] (COLLECTIONS-806) Upgrade junit.framework.Test to org.junit.jupiter.api.Test

2022-12-26 Thread ASF GitHub Bot (Jira)


 [ 
https://issues.apache.org/jira/browse/COLLECTIONS-806?focusedWorklogId=835702=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-835702
 ]

ASF GitHub Bot logged work on COLLECTIONS-806:
--

Author: ASF GitHub Bot
Created on: 26/Dec/22 20:58
Start Date: 26/Dec/22 20:58
Worklog Time Spent: 10m 
  Work Description: pas725 opened a new pull request, #371:
URL: https://github.com/apache/commons-collections/pull/371

   **Jira**: https://issues.apache.org/jira/browse/COLLECTIONS-806
   
   **Description**: COLLECTIONS-806 is a subtask of the main task 
[COLLECTIONS-777-Fully migrate to JUnit 
5](https://issues.apache.org/jira/browse/COLLECTIONS-777)
   
   **Subtask** **COLLECTIONS-806 description**: Upgrade org.junit.Test to 
org.junit.jupiter.api.Test
   
   
   **Changes**
   - Removed references of `junit.framework.Test` from tests
   - Removed unused method `BulkTest.makeSuite()`




Issue Time Tracking
---

Worklog Id: (was: 835702)
Time Spent: 2h 40m  (was: 2.5h)

> Upgrade junit.framework.Test to org.junit.jupiter.api.Test
> --
>
> Key: COLLECTIONS-806
> URL: https://issues.apache.org/jira/browse/COLLECTIONS-806
> Project: Commons Collections
>  Issue Type: Sub-task
>Reporter: John Patrick
>Priority: Major
>  Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> Covers '57' usages of legacy usage of;
> {code:java}
> import junit.framework.Test;
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [commons-collections] pas725 opened a new pull request, #371: COLLECTIONS-806: removed references of JUnit4 Test class

2022-12-26 Thread GitBox


pas725 opened a new pull request, #371:
URL: https://github.com/apache/commons-collections/pull/371

   **Jira**: https://issues.apache.org/jira/browse/COLLECTIONS-806
   
   **Description**: COLLECTIONS-806 is a subtask of the main task 
[COLLECTIONS-777-Fully migrate to JUnit 
5](https://issues.apache.org/jira/browse/COLLECTIONS-777)
   
   **Subtask** **COLLECTIONS-806 description**: Upgrade org.junit.Test to 
org.junit.jupiter.api.Test
   
   
   **Changes**
   - Removed references of `junit.framework.Test` from tests
   - Removed unused method `BulkTest.makeSuite()`


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] garydgregory commented on a diff in pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


garydgregory commented on code in PR #344:
URL: https://github.com/apache/commons-compress/pull/344#discussion_r1057339000


##
src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java:
##
@@ -25,20 +28,27 @@
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarInputStream;
 import java.util.jar.JarOutputStream;
+import java.util.stream.Stream;
 
 import org.apache.commons.compress.harmony.pack200.Archive;
 import org.apache.commons.compress.harmony.pack200.Pack200Exception;
 import org.apache.commons.compress.harmony.pack200.PackingOptions;
 import org.apache.commons.compress.harmony.unpack200.Segment;
 
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
-public class ArchiveTest extends TestCase {
+class ArchiveTest {

Review Comment:
   There is no need to change the visibility of elements, it just overloads the 
PR with noise for no gain. Yes, I know that JUnit 5 like this style, but that 
is not the style we use in most if not all of Conmons components. It just make 
the PR harder and longer to review. What matters is the use of the Junit API, 
not the style IMO. For my money, the fact that a test is public tells me it's 
important, not some internal gadget, so let's not change access unless required 
(which should not happen).



-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] garydgregory commented on a diff in pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


garydgregory commented on code in PR #344:
URL: https://github.com/apache/commons-compress/pull/344#discussion_r1057339000


##
src/test/java/org/apache/commons/compress/harmony/pack200/tests/ArchiveTest.java:
##
@@ -25,20 +28,27 @@
 import java.io.InputStreamReader;
 import java.io.OutputStream;
 import java.net.URISyntaxException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Enumeration;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
 import java.util.jar.JarInputStream;
 import java.util.jar.JarOutputStream;
+import java.util.stream.Stream;
 
 import org.apache.commons.compress.harmony.pack200.Archive;
 import org.apache.commons.compress.harmony.pack200.Pack200Exception;
 import org.apache.commons.compress.harmony.pack200.PackingOptions;
 import org.apache.commons.compress.harmony.unpack200.Segment;
 
-import junit.framework.TestCase;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.params.ParameterizedTest;
+import org.junit.jupiter.params.provider.Arguments;
+import org.junit.jupiter.params.provider.MethodSource;
 
-public class ArchiveTest extends TestCase {
+class ArchiveTest {

Review Comment:
   There is no need to change the visibility of elements, it just overloads the 
PR with noise for no gain. Yes, I know that JUnit 5 like this style, but that 
is not the style we use in most of not all of Conmons components. It just make 
the PR harder and longer to review. What matters is the use of the Junit API, 
not the style IMO. For my money, the fact that a test is public tells me it's 
important, not some internal gadget, so let's not change access unless required 
(which should not happen).



-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-jexl] henrib merged pull request #149: JEXL-390: Pragmas should not be statements

2022-12-26 Thread GitBox


henrib merged PR #149:
URL: https://github.com/apache/commons-jexl/pull/149


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] theobisproject commented on pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


theobisproject commented on PR #344:
URL: https://github.com/apache/commons-compress/pull/344#issuecomment-1365283815

   I have replaced all the try-catch-assert patterns in the tests I migrated. 
Also more tests do now use the parameterized tests for execution.


-- 
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-unsubscr...@commons.apache.org

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



[jira] [Commented] (FILEUPLOAD-309) Release version 2.0.0

2022-12-26 Thread Andy Seaborne (Jira)


[ 
https://issues.apache.org/jira/browse/FILEUPLOAD-309?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17652022#comment-17652022
 ] 

Andy Seaborne commented on FILEUPLOAD-309:
--

I tried the servlet 3.1 multipart support.

Our (Jena) usage is
* a servlet filter
* deployed in any servlet container - normally bundled with Jetty; some users 
deploy a WAR file version in Tomcat et al.
* `multipart/form-data` is just one possible content-type at the URL endpoint.
* streaming (errors are handled by being inside a database transaction)

Each servlet container needs custom configuration. 

`@MultipartConfig` only applies to servlets, not servlet filters. 
https://github.com/jakartaee/servlet/issues/87

Jetty: the code can set request attribute `__MULTIPART_CONFIG_ELEMENT` during 
request processing.

Tomcat needs a setting of a context XML attribute 
`allowCasualMultipartParsing`. Set in e.g. `META-INF/context.xml`.


> Release version 2.0.0
> -
>
> Key: FILEUPLOAD-309
> URL: https://issues.apache.org/jira/browse/FILEUPLOAD-309
> Project: Commons FileUpload
>  Issue Type: Wish
>Reporter: Thiago Henrique Hupner
>Priority: Major
>
> At Piranha, we've migrated to use the new Jakarta namespace.
> One of our dependencies is the Commons File Upload, but the latest version 
> available is 1.4.
> Looking around at the source code, I've found that the code is already 
> prepared for the new Jakarta namespace.
> So, I want to know if there's a plan to release a new version soon. Or at 
> least a 2.0.0 milestone.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[GitHub] [commons-compress] garydgregory commented on pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


garydgregory commented on PR #344:
URL: https://github.com/apache/commons-compress/pull/344#issuecomment-1365225577

   Keep it focused on the one task please: Junit 5 


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] theobisproject commented on pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


theobisproject commented on PR #344:
URL: https://github.com/apache/commons-compress/pull/344#issuecomment-1365219087

   @garydgregory I will go through the classes and do some more migrations. Is 
there anything else you would like to have changed (like using 
try-with-resources, ...)?


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] garydgregory commented on pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


garydgregory commented on PR #344:
URL: https://github.com/apache/commons-compress/pull/344#issuecomment-1365207025

   Hi @theobisproject 
   Thank you for pitching in!
   No matter which way you slice it, it's going to be a large PR. The only way 
I can think of making it smaller is by doing it one package at a time. 
Whichever way you go, I'd rather see it all done the "JUnit 5 way" rather than 
something in between.


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] theobisproject commented on a diff in pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


theobisproject commented on code in PR #344:
URL: https://github.com/apache/commons-compress/pull/344#discussion_r1057249368


##
src/test/java/org/apache/commons/compress/archivers/LongPathTest.java:
##
@@ -142,7 +140,7 @@ public void testArchive(final File file) throws Exception {
 }
 try {
 checkArchiveContent(ais, expected);
-} catch (final AssertionFailedError e) {
+} catch (final Exception e) {

Review Comment:
   I'm with you on this one (and the one in the LongSymLinkTest). Just did not 
want to do too much in one go.
   
   If I understand the test correctly we can get rid of the try-catch block 
completely since we do not want the check to throw an exception.



-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] garydgregory commented on a diff in pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


garydgregory commented on code in PR #344:
URL: https://github.com/apache/commons-compress/pull/344#discussion_r1057246093


##
src/test/java/org/apache/commons/compress/archivers/LongPathTest.java:
##
@@ -142,7 +140,7 @@ public void testArchive(final File file) throws Exception {
 }
 try {
 checkArchiveContent(ais, expected);
-} catch (final AssertionFailedError e) {
+} catch (final Exception e) {

Review Comment:
   -1: Porting to JUnit 5 means using `Assertions.assertThrows()`, 
`Assertions.doesNotThrow()`, and so on, not whatever this is.



-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] garydgregory commented on a diff in pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


garydgregory commented on code in PR #344:
URL: https://github.com/apache/commons-compress/pull/344#discussion_r1057246093


##
src/test/java/org/apache/commons/compress/archivers/LongPathTest.java:
##
@@ -142,7 +140,7 @@ public void testArchive(final File file) throws Exception {
 }
 try {
 checkArchiveContent(ais, expected);
-} catch (final AssertionFailedError e) {
+} catch (final Exception e) {

Review Comment:
   -1: Porting to JUnit 5 means using `Assert.assertThrows()`, not whatever 
this is.



-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] codecov-commenter commented on pull request #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


codecov-commenter commented on PR #344:
URL: https://github.com/apache/commons-compress/pull/344#issuecomment-1365200978

   # 
[Codecov](https://codecov.io/gh/apache/commons-compress/pull/344?src=pr=h1_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 Report
   > Merging 
[#344](https://codecov.io/gh/apache/commons-compress/pull/344?src=pr=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (0bcbf32) into 
[master](https://codecov.io/gh/apache/commons-compress/commit/f6dadd24b4b20f46541110b0146ce8413430e873?el=desc_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
 (f6dadd2) will **not change** coverage.
   > The diff coverage is `n/a`.
   
   ```diff
   @@Coverage Diff@@
   ## master #344   +/-   ##
   =
 Coverage 80.33%   80.33%   
 Complexity 6653 6653   
   =
 Files   342  342   
 Lines 2523225232   
 Branches   4085 4085   
   =
 Hits  2027120271   
 Misses 3382 3382   
 Partials   1579 1579   
   ```
   
   
   
   :mega: We’re building smart automated test selection to slash your CI/CD 
build times. [Learn 
more](https://about.codecov.io/iterative-testing/?utm_medium=referral_source=github_content=comment_campaign=pr+comments_term=The+Apache+Software+Foundation)
   


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-compress] theobisproject opened a new pull request, #344: Replace JUnit 3 with JUnit 5

2022-12-26 Thread GitBox


theobisproject opened a new pull request, #344:
URL: https://github.com/apache/commons-compress/pull/344

   Most tests are replaced with simple JUnit 5 tests. A small number of tests 
were migrated to parameterized tests.


-- 
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-unsubscr...@commons.apache.org

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



[GitHub] [commons-scxml] garydgregory merged pull request #97: Bump groovy from 3.0.13 to 3.0.14

2022-12-26 Thread GitBox


garydgregory merged PR #97:
URL: https://github.com/apache/commons-scxml/pull/97


-- 
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-unsubscr...@commons.apache.org

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