Comments (6)
Bug reported by @bgmf on issue #4
java.lang.RuntimeException: jcifs.smb.SmbException: The system cannot find the file specified.
at no.uis.nio.smb.SMBDirectoryStream.iterator(SMBDirectoryStream.java:71)
at no.uis.nio.smb.SambaTest.testSamba(SambaTest.java:56)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: jcifs.smb.SmbException: The system cannot find the file specified.
at jcifs.smb.SmbTransport.checkStatus(SmbTransport.java:542)
at jcifs.smb.SmbTransport.send(SmbTransport.java:619)
at jcifs.smb.SmbSession.send(SmbSession.java:242)
at jcifs.smb.SmbTree.send(SmbTree.java:111)
at jcifs.smb.SmbFile.send(SmbFile.java:729)
at jcifs.smb.SmbFile.doFindFirstNext(SmbFile.java:1931)
at jcifs.smb.SmbFile.doEnum(SmbFile.java:1683)
at jcifs.smb.SmbFile.listFiles(SmbFile.java:1660)
at jcifs.smb.SmbFile.listFiles(SmbFile.java:1593)
at no.uis.nio.smb.SMBDirectoryStream.iterator(SMBDirectoryStream.java:61)
... 24 more
from nio-fs-provider.
@bgmf: Would you like to share your test case that fails?
from nio-fs-provider.
Of course. Its more or less the same, like in the last case:
@Test
public void testSamba() {
Logger.getLogger("").setLevel(Level.SEVERE);
Config.registerSmbURLHandler();
Path remotePath = null;
try {
NtlmAuthenticator.setDefault(new NtlmAuthenticator() {
private NtlmPasswordAuthentication pa = new NtlmPasswordAuthentication("domain", "user", "password");
@Override
protected NtlmPasswordAuthentication getNtlmPasswordAuthentication() {
return pa;
}
});
remotePath = Paths.get(new URI("smb://address/c$/Android%20Studio/"));
} catch (URISyntaxException e1) {
e1.printStackTrace();
}
ArrayList<String> fileNames = new ArrayList<>();
try (DirectoryStream<Path> directoryStream = Files.newDirectoryStream(remotePath, new DirectoryStream.Filter<Path>() {
@Override
public boolean accept(Path entry) throws IOException {
return !Files.isSymbolicLink(entry);
}
})) {
for (Path path : directoryStream) {
fileNames.add(path.toString());
}
} catch (Exception ex) {
ex.printStackTrace();
}
System.out.println(fileNames);
}
This example will fail because of the encoded space character %20
. I tried to deal with it in any way, but since we rely on URI, we have no other option then to use the encoding, otherwise we get an malformed URI exception.
from nio-fs-provider.
The merge should fix the issue. I have simplified the test cases. Your use case should be covered. The tricky thing is the inconsistency between URL and URI in how they treat spaces. URI is consistent with itself.
from nio-fs-provider.
Thumbs up! Works for me.
Tested it with a couple of directories over the net and got no further errors (except for some obvious "Access Denied", when I tried to access "Documents and Settings").
Thank you very much for your effort. If I find anything new, I will report it. ;-)
from nio-fs-provider.
Thanks for your feedback. I published a SNAPSHOT release to the Sonatype Snapshot Release (https://oss.sonatype.org/content/repositories/snapshots/) with the following coordinates:
<dependency>
<groupId>no.maddin.niofs</groupId>
<artifactId>nio-fs-webdav</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
I would be happy if you could use this artifact. I am planning on releasing this version by the end of the week, if nothing serious turns up.
from nio-fs-provider.
Related Issues (14)
- Cannot build HEAD HOT 2
- Change groupId no no.maddin.niofs
- Rewrite sftp tests to use testcontainers
- Create standard test suit for all providers
- Require more modern Java distribution
- Create some documentation in gh pages
- checkstyle rule for packages is wrong
- Improve Code Coverage
- Update versions according to versioneye report
- Improve Reliability Rating on sonarqube.com
- Upgrade the webdav test library / probably others HOT 16
- Spaces in URI lead to an Exception HOT 6
- some rather large updates for webdav-nio-fs-provider HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nio-fs-provider.