Closed flappingeagle closed 6 years ago
hmm, now that i think of it....
the Methods "FileSystems.createFileSystem(uri)" and "Paths.get" do work correctly!.... i think you can close this ticket because it seems it already works correctly.
@flappingeagle - thank you for your report. If I am correct, the current behavior follows the contract of FileSystems.getFileSystem(java.net.URI)
: returns a reference to an existing FileSystem
Thus, the code that you reported should be:
final URI uri = new URI("http://localhost:8000/");
final Path rootPath = FileSystems.newFileSystem(uri, Collections.emptyMap()).getPath("/test/test.txt");
And because it is the caller responsibility to assess that the filesystem is open, I would suggest to load the filesystem for the URI
with the try block:
final URI uri = new URI("http://localhost:8000/");
final FileSystem fs;
try {
fs = FileSystems.newFileSystem(uri, Collections.emptyMap());
} catch (final FileSystemAlreadyExistsException e) {
fs = FileSystems.getFileSystem(uri);
}
final Path rootPath = fs.getPath("/test/test.txt);
thanks, you are correct :)
@flappingeagle - no problem, thanks for the interest on the library. I guess that I would pre-release 0.1.0 soon (I hope!)
It would be good if the library could be used with the Java NIO FileSystems API. See: https://docs.oracle.com/javase/7/docs/api/java/nio/file/FileSystems.html
please try following code with your library: (after creating the usual "java.nio.file.spi.FileSystemProvider" file in META-INF)
it will crash with a "java.nio.file.FileSystemNotFoundException".
Could you please fix following code in your "AbstractHttpFileSystemProvider":
it should be like following to work:
thanx!, greetings.