[CSV] [CSV-270]: Introduce parsing exception for Parser issues in CSV

2023-09-11 Thread Buddhi De Silva
Hello Commons-Devs,

*Related JIRA issue*: https://issues.apache.org/jira/browse/CSV-270
Improvement suggested in above Jira issue: To clearly identify the CSV
parser related issue from *IOException *issues, introduce a new parser
exception.

Current behavior: For all parser issues, code is throwing *IOException*.

Notes:
I have gone through the requirements discussed in this issue description
and have created a git diff on possible locations where we can introduce
the new Exception type for CSV parse issues.

I can work on this issue if we have possible go ahead for these changes.

In the comments, it is mentioned that we should consider using
*IllegalStateException* whenever possible instead of introducing a new
exception type for CSV parse issues.
Therefore, I have looked at the official JavaDoc documentation for
*IllegalStateException* it says:
*IllegalStateException *-> "Signals that a method has been invoked at an
illegal or inappropriate time. In other words, the Java environment or Java
application is not in an appropriate state for the requested operation."
[Ref:
https://docs.oracle.com/javase%2F7%2Fdocs%2Fapi%2F%2F/java/lang/IllegalStateException.html
]
By simply looking at the definition of *IllegalStateException*, IMO, it
does not seems to be an ideal candidate to notify regarding the CSV parsing
issues. Therefore, I think it is best to introduce a new Exception such as
'ParserException' etc.

Link to the Git Diff containing comments:
https://github.com/apache/commons-csv/compare/master...gbidsilva:commons-csv-osc:CSV-270

Appreciate your feedback on this.

Thank you.
Buddhi De Silva.


[vfs] test failure in the master branch

2023-09-11 Thread Woonsan Ko
Hi,

While I was preparing a PR, I got test failures below after running
`mvn` in the master branch of the commons-vfs.
Any hints for this? (I'm with maven-3.9.2 on JDK 1.8 / windows 10.)

Thanks!

Woonsan

-

[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time
elapsed: 0.322 s <<< FAILURE! - in
org.apache.commons.vfs2.provider.sftp.SftpPermissionExceptionTestCase
[ERROR] org.apache.commons.vfs2.provider.sftp.SftpPermissionExceptionTestCase$1
 Time elapsed: 0.001 s  <<< ERROR!
org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP
server at "sftp://testtest@localhost:54130/";.
at 
org.apache.commons.vfs2.provider.sftp.SftpFileProvider.createSession(SftpFileProvider.java:78)
at 
org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:91)
at 
org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:105)
at 
org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:60)
at 
org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:88)
at 
org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:785)
at 
org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:832)
at 
org.apache.commons.vfs2.provider.sftp.AbstractSftpProviderTestCase.getBaseTestFolder(AbstractSftpProviderTestCase.java:592)
at 
org.apache.commons.vfs2.provider.sftp.SftpPermissionExceptionTestCase.getBaseTestFolder(SftpPermissionExceptionTestCase.java:35)
at 
org.apache.commons.vfs2.AbstractTestSuite.setUp(AbstractTestSuite.java:268)
at 
org.apache.commons.vfs2.provider.sftp.AbstractSftpProviderTestCase$SftpProviderTestSuite.setUp(AbstractSftpProviderTestCase.java:241)
at 
org.apache.commons.vfs2.AbstractTestSuite.lambda$run$0(AbstractTestSuite.java:234)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at 
org.apache.commons.vfs2.AbstractTestSuite.run(AbstractTestSuite.java:239)
at 
org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:90)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at org.junit.runner.JUnitCore.run(JUnitCore.java:115)
at 
org.junit.vintage.engine.execution.RunnerExecutor.execute(RunnerExecutor.java:42)
at 
org.junit.vintage.engine.VintageTestEngine.executeAllChildren(VintageTestEngine.java:80)
at 
org.junit.vintage.engine.VintageTestEngine.execute(VintageTestEngine.java:72)
at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at 
org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at 
org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at 
org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at 
org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:50)
at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:184)
at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:148)
at 
org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:122)
at 
org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:385)
at 
org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:162)
at 
org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:507)
at 
org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:495)
Caused by: org.apache.commons.vfs2.FileSystemException: Could not
connect to SFTP server at "localhost".
at 
org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:237)
at 
org.apache.commons.vfs2.provider.sftp.SftpFileProvider.createSession(SftpFileProvider.java:71)
... 36 more
Caused by: com.jcraft.jsch.JSchException: Session.connect:
java.io.IOException: End of IO