[ 
https://issues.apache.org/jira/browse/VFS-822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17571847#comment-17571847
 ] 

Mark van der Walle commented on VFS-822:
----------------------------------------

I created a bare minimum example. i omitted the URI to the file as I am not 
allowed to share that.

 
{code:java}
INFO: Authentication succeeded (password).
Exception in thread "main" org.apache.commons.vfs2.FileSystemException: Could 
not determine if file "omittedforprivacyreasons" is readable.
    at 
org.apache.commons.vfs2.provider.AbstractFileObject.isReadable(AbstractFileObject.java:1582)
    at nl.ocwduo.sftptest.VFSTest.main(VFSTest.java:39)
Caused by: java.lang.NumberFormatException: For input string: ""
    at 
java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
    at java.base/java.lang.Integer.parseInt(Integer.java:662)
    at java.base/java.lang.Integer.parseInt(Integer.java:770)
    at 
org.apache.commons.vfs2.provider.sftp.SftpFileSystem.getGroupsIds(SftpFileSystem.java:267)
    at 
org.apache.commons.vfs2.provider.sftp.SftpFileObject.getPermissions(SftpFileObject.java:467)
    at 
org.apache.commons.vfs2.provider.sftp.SftpFileObject.doIsReadable(SftpFileObject.java:257)
    at 
org.apache.commons.vfs2.provider.AbstractFileObject.isReadable(AbstractFileObject.java:1580)
    ... 1 more{code}

> getGroupIds fails when user has no groups
> -----------------------------------------
>
>                 Key: VFS-822
>                 URL: https://issues.apache.org/jira/browse/VFS-822
>             Project: Commons VFS
>          Issue Type: Bug
>    Affects Versions: 2.9.0
>            Reporter: Mark van der Walle
>            Priority: Major
>
> In 
> [https://github.com/apache/commons-vfs/blob/master/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java#L258]
>  the groupIds are retrieved using the command id -G. If a user has no groups 
> (gid=0 for example) then the result is that:
> [https://github.com/apache/commons-vfs/blob/master/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystem.java#L264]
> will have an array with one entry being an empty string. This results in a 
> NumberFormatException.



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

Reply via email to