You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "dgü (Jira)" <ji...@apache.org> on 2022/01/24 01:14:00 UTC

[jira] [Commented] (SSHD-1238) java.nio.file.FileSystemNotFoundException by SftpFileSystemProvider.getFileSystem

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

dgü commented on SSHD-1238:
---------------------------

The note:

{noformat}
Caveat: Due to URI encoding of the username/password as a basic authentication, the system currently does not allow colon (:) in either one in order to avoid parsing confusion. See RFC 3986 - section 3.2.1:

Use of the format "user:password" in the userinfo field is deprecated ... Applications may choose to ignore or reject such data when it is received as part of a reference...
{noformat}
Ref: https://github.com/apache/mina-sshd/blob/master/docs/sftp.md

But, there are examples using "user:password" on the this page.

does it mean it is impossible to use "user:password" in URI ? If not, how can I use "user:password" ? At least for test...

thanks in advance!


> java.nio.file.FileSystemNotFoundException by SftpFileSystemProvider.getFileSystem
> ---------------------------------------------------------------------------------
>
>                 Key: SSHD-1238
>                 URL: https://issues.apache.org/jira/browse/SSHD-1238
>             Project: MINA SSHD
>          Issue Type: Request
>    Affects Versions: 2.8.0
>         Environment: Java SE 8, Apache NetBeans IDE 12.5
>            Reporter: dgü
>            Priority: Major
>
> Hello!
> The following code runs successfully:
> {noformat}
>     public static void main(String[] args) throws IOException  {
>         URI uri = SftpFileSystemProvider.createFileSystemURI("127.0.0.1", 22, "deneme", "deneme123");
>         try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.<String, Object>emptyMap())) {
>             Path localPath = fs.getPath("C:/Users/XXX/Desktop/sil/sftp/sil1.txt");
>             Path targetPath = fs.getPath("C:/Users/XXX/Desktop/sil/sftp/sil2.txt");
>             Files.copy(localPath, targetPath, StandardCopyOption.REPLACE_EXISTING);
>         }
>     }
> {noformat}
> The following code fails:
> {noformat}
>     public static void main(String[] args) throws URISyntaxException  {
>         Path sourceFile = Paths.get(new URI("sftp://deneme:deneme123@127.0.0.1/C:/Users/XXX/Desktop/sil/sftp/sil.txt"));
>     }
> {noformat}
> The exeption is:
> {noformat}
> Exception in thread "main" java.nio.file.FileSystemNotFoundException: 127.0.0.1:22:deneme
> 	at org.apache.sshd.sftp.client.fs.SftpFileSystemProvider.getFileSystem(SftpFileSystemProvider.java:451)
> 	at org.apache.sshd.sftp.client.fs.SftpFileSystemProvider.getPath(SftpFileSystemProvider.java:492)
> 	at java.nio.file.Paths.get(Paths.java:143)
> 	at com.ubtools.ubutils.UBTest.main(UBTest.java:30)
> {noformat}
>  
> How can I solve this problem ?
> Thanks!



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@mina.apache.org
For additional commands, e-mail: dev-help@mina.apache.org