robtimus / ftp-fs Goto Github PK
View Code? Open in Web Editor NEWAn FTP(S) NIO.2 file system
Home Page: https://robtimus.github.io/ftp-fs/
License: Apache License 2.0
An FTP(S) NIO.2 file system
Home Page: https://robtimus.github.io/ftp-fs/
License: Apache License 2.0
Thank you for sharing your work, it really helps me
I meet some problem when i try to connect my server by ftps, it returns:
org.apache.commons.net.MalformedServerReplyException: Could not parse response code. Server Reply: SSH-2.0-OpenSSH_7.4
Here is my code:
public void syncImages() throws URISyntaxException, IOException {
FTPSEnvironment env = new FTPSEnvironment()
.withCredentials("root", "123456".toCharArray());
FileSystem server = FileSystems.newFileSystem(URI.create("ftps://10.146.168.39"), env);
Path path = server.getPath("/data/app/mobile-materials/public/img/");
int a = 1;
}
How can i solve this problem?
Thank you
Reporting here robtimus/sftp-fs#14 (comment) as I am first dealing with ftp.
When I try to list directory contents stored on a FileZilla server, I always get a java.nio.file.NotDirectoryException
. This seems to come from the fact that FileZilla doesn't emit .
when using the LIST
command.
Without an explicit clean, checkstyle complains about a generated file in the target directory:
$ mvn validate
[INFO] Scanning for projects...
[INFO] Inspecting build with total of 1 modules...
[INFO] Installing Nexus Staging features:
[INFO] ... total of 1 executions of maven-deploy-plugin replaced with nexus-staging-maven-plugin
[INFO]
[INFO] ---------------------< com.github.robtimus:ftp-fs >---------------------
[INFO] Building ftp-fs 2.2-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-checkstyle-plugin:3.1.1:check (default) @ ftp-fs ---
[INFO] Starting audit...
[WARN] /home/jse/work/3rdParty/ftp-fs/target/classes/com/github/robtimus/filesystems/ftp/fs.properties:4: Line is longer than 150 characters (found 263). [LineLength]
Audit done.
[WARNING] target/classes/com/github/robtimus/filesystems/ftp/fs.properties:[4] (sizes) LineLength: Line is longer than 150 characters (found 263).
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.030 s
[INFO] Finished at: 2020-11-20T13:08:37+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:check (default) on project ftp-fs: You have 1 Checkstyle violation. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
Build project first to reproduce this. Users will run into it when they generate an Eclipse project after an successful build.
Hello
I noticed that the FTPLogger class is never used.
the only reference is in FTPClientPool and this is just the call to createLogger that just encapsulates LoggerFactory.getLooger of SLf4J.
I do not understand the presence of this class.
A+JYT
First of all, I am very impressed with your implementation! Thank you for sharing your work!
Curious if you have any thoughts on this...
I was experimenting with ftp-fs with a python FTP server pyftpdlib.
Files.list(fs.getPath("dir1"))
threw an exception, although the directory did exist. Upon debugging I learned that for some reason (I have not determined exactly) pyftpdlib does not support FTP command LIST
with option -a
. Apparently this is controlled by FTPClient#setListHiddenFiles(true/false)
.
I did find a workaround:
I manually subclassed FTPEnvironment to instead call client.setListHiddenFiles(true)
. The Files.list(...)
invocation worked.
I don't see an explicit comment in the FTPEnvironment#initializePreConnect()
method on indicating why we need to setListHiddenFiles(true)
at this point, but I presume it is intended to set that property in case a user wishes to access hidden files. Have you considered if this setting should be configurable somehow (other than subclassing) since it is not part of the FTPClientConfig
object?
void initializePreConnect(FTPClient client) throws IOException {
client.setListHiddenFiles(true); // not all FTP clients appear to support this
if (containsKey(SEND_BUFFER_SIZE)) {
int size = FileSystemProviderSupport.getIntValue(this, SEND_BUFFER_SIZE);
client.setSendBufferSize(size);
}
....
Expected: build completes without errors
Actual:
Failed to execute goal org.apache.maven.plugins:maven-javadoc-plugin:3.6.0:jar (default) on project ftp-fs: MavenReportException: Error while generating Javadoc:
Exit code: 2
error: No source files for package com.github.robtimus.filesystems.ftp
PS: same thing for sftp-fs
Hi. I'm quite new to FTP in general, so I might be missing something obvious here!
I'm just trying out your library, and attempting to connect to ftp://speedtest.tele2.net/
, which is a public ftp "test server". But I get an exception:
java.lang.IllegalArgumentException: URI has a path component: ftp://speedtest.tele2.net/
at com.github.robtimus.filesystems.Messages$URIMessages.hasPath(Messages.java:714)
at com.github.robtimus.filesystems.ftp.FTPFileSystemProvider.checkURI(FTPFileSystemProvider.java:168)
at com.github.robtimus.filesystems.ftp.FTPFileSystemProvider.newFileSystem(FTPFileSystemProvider.java:89)
at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:344)
at java.base/java.nio.file.FileSystems.newFileSystem(FileSystems.java:293)
How would I go on resolving this?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.