简体   繁体   English

Apache VFS的SSH URI错误

[英]SSH URI error with Apache VFS

I'm getting the following error in an Android application with Apache VFS and I can't find much on the google to help. 我在使用Apache VFS的Android应用程序中遇到以下错误,但在Google上找不到太多帮助。 I'm trying to upload a file via SSH and I get this rather vague error. 我正在尝试通过SSH上传文件,但出现了这个模糊的错误。 The URI, as reported in logcat, looks correct to me according to the VFS docs. 根据VFS文档,logcat中报告的URI对我来说看起来正确。 The only thing I can figure is that it only expects to see a local network host instead of a TLD. 我唯一能想到的是,它只希望看到本地网络主机,而不是TLD。 Is this true, and if so, how do I fix it? 这是真的吗?如果是,该如何解决? If not, what looks wrong about this URI to you? 如果不是,那么对您而言,此URI看起来有什么问题?

Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://username:***@mydomain.com/public_html/". 

The errors are the same with or without a specific destination filename. 有或没有特定目标文件名时,错误相同。

Here's the full logcat output. 这是完整的logcat输出。

01-22 19:41:15.660: E/AndroidRuntime(1997): FATAL EXCEPTION: main
01-22 19:41:15.660: E/AndroidRuntime(1997): java.lang.RuntimeException: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.upload(SiteEditor.java:279)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.testSFTPSite(SiteEditor.java:289)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor$10.onClick(SiteEditor.java:629)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.view.View.performClick(View.java:2532)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.view.View$PerformClick.run(View.java:9293)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Handler.handleCallback(Handler.java:587)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Handler.dispatchMessage(Handler.java:92)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.os.Looper.loop(Looper.java:150)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at android.app.ActivityThread.main(ActivityThread.java:4263)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at java.lang.reflect.Method.invokeNative(Native Method)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at java.lang.reflect.Method.invoke(Method.java:507)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at dalvik.system.NativeStart.main(Native Method)
01-22 19:41:15.660: E/AndroidRuntime(1997): Caused by: org.apache.commons.vfs2.FileSystemException: Invalid absolute URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:61)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:693)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:621)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at app.specialsauce.myapp.SiteEditor.upload(SiteEditor.java:265)
01-22 19:41:15.660: E/AndroidRuntime(1997):     ... 13 more
01-22 19:41:15.660: E/AndroidRuntime(1997): Caused by: org.apache.commons.vfs2.FileSystemException: Expecting / to follow the hostname in URI "sftp://username:***@mysite.com/public_html/".
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.HostFileNameParser.extractToPath(HostFileNameParser.java:155)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.URLFileNameParser.parseUri(URLFileNameParser.java:50)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractFileProvider.parseUri(AbstractFileProvider.java:188)
01-22 19:41:15.660: E/AndroidRuntime(1997):     at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:57)
01-22 19:41:15.660: E/AndroidRuntime(1997):     ... 16 more

I suspect you have a problematic character in the password (as this is the only info not shown). 我怀疑您的密码字符有问题(因为这是唯一未显示的信息)。 You need to percent-encode the username and password before adding it to the URL. 您需要先对用户名和密码进行百分比编码,然后再将其添加到URL。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM