"No such file" error while closing RemoteFile
- Dominant language
- Java
- Stars
- 2.7k
- Forks
- 620
- Avg merge
- 3d 23h
- Merged PRs (30d)
- 11
Description
Hi,
I am getting "no such file" exception while calling close on RemoteFile object (file.close() below).
```
public void get(String path, CheckedConsumer consumer) throws SSHException {
try {
SFTPClient client = sshClient.newSFTPClient();
final RemoteFile file = client.getSFTPEngine().open(path, EnumSet.of(OpenMode.READ));
InputStream inputStream = getInputStream(file);
} finally {
if (inputStream != null) {
inputStream.close();
}
.....
}
}
private RemoteFile.RemoteFileInputStream getInputStream(RemoteFile file) {
return file.new RemoteFileInputStream() {
@Override
public void close() throws IOException {
try (file) {
super.close();
} finally {
file.close();
}
}
};
}
```
Here is info from stacktrace:
`net.schmizz.sshj.sftp.SFTPException: No such file
at net.schmizz.sshj.sftp.Response.error(Response.java:140)
at net.schmizz.sshj.sftp.Response.ensureStatusIs(Response.java:133)
at net.schmizz.sshj.sftp.Response.ensureStatusPacketIsOK(Response.java:125)
at net.schmizz.sshj.sftp.RemoteResource.close(RemoteResource.java:55)`
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.