You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Andrey Turbanov (Jira)" <ji...@apache.org> on 2021/12/22 13:34:00 UTC
[jira] [Created] (VFS-813) NullPointerException in SftpClientFactory when connect with private key
Andrey Turbanov created VFS-813:
-----------------------------------
Summary: NullPointerException in SftpClientFactory when connect with private key
Key: VFS-813
URL: https://issues.apache.org/jira/browse/VFS-813
Project: Commons VFS
Issue Type: Bug
Affects Versions: 2.9.0
Reporter: Andrey Turbanov
I'm trying to use common-vfs2 to load files from sftp server.
Got NPE inside SftpClientFactory, when trying to connect to server.
{noformat}
W 211222 162440.053 [ST3-Def] DxReconciliationFileLoader -
org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp://sftp.myhost.com/".
at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.createSession(SftpFileProvider.java:72) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.doCreateFileSystem(SftpFileProvider.java:92) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.getFileSystem(AbstractOriginatingFileProvider.java:92) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:71) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:55) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:788) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:835) ~[commons-vfs2-2.9.0.jar:2.9.0]
at com.tools.DxReconciliationFileLoader.downloadFiles(DxReconciliationFileLoader.java:118) ~[classes/:?]
Caused by: org.apache.commons.vfs2.FileSystemException: Could not connect to SFTP server at "sftp.myhost.com".
at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:228) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.createSession(SftpFileProvider.java:65) ~[commons-vfs2-2.9.0.jar:2.9.0]
... 16 more
Caused by: java.lang.NullPointerException
at java.lang.String.<init>(String.java:251) ~[?:?]
at org.apache.commons.vfs2.provider.sftp.SftpClientFactory.createConnection(SftpClientFactory.java:159) ~[commons-vfs2-2.9.0.jar:2.9.0]
at org.apache.commons.vfs2.provider.sftp.SftpFileProvider.createSession(SftpFileProvider.java:65) ~[commons-vfs2-2.9.0.jar:2.9.0]
... 16 more
{noformat}
{{char[] username}} is *null*.
Looks like I should specify username somewhere.
I think if username is required for key-based auth, then library should handle it better, than throwing NPE.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)