Skip to content

Commit

Permalink
SmbjFileEditor: check that DiskShare is still open when closing file
Browse files Browse the repository at this point in the history
  • Loading branch information
courville committed Feb 12, 2024
1 parent f02859c commit 63d0f23
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/com/archos/filecorelibrary/smbj/SmbjFileEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ public InputStream getInputStream() throws Exception {
ObservableInputStream ois = new ObservableInputStream(is);
ois.onClose(() -> {if (smbjFile != null) {
log.trace("getInputStream: closing " + mUri);
smbjFile.closeSilently();
// check that DiskShare has not already been closed (seen on sentry)
if (smbjFile.getDiskShare().isConnected()) smbjFile.closeSilently();
}});
return ois;
}
Expand All @@ -78,7 +79,8 @@ public InputStream getInputStream(long from) throws Exception {
ObservableInputStream ois = new ObservableInputStream(is);
ois.onClose(() -> {if (smbjFile != null) {
log.trace("getInputStream: closing " + mUri);
smbjFile.closeSilently();
// check that DiskShare has not already been closed (seen on sentry)
if (smbjFile.getDiskShare().isConnected()) smbjFile.closeSilently();
}});
return ois;
}
Expand All @@ -95,7 +97,8 @@ public OutputStream getOutputStream() throws Exception {
ObservableOutputStream oos = new ObservableOutputStream(os);
oos.onClose(() -> {if (smbjFile != null) {
log.trace("getOutputStream: closing " + mUri);
smbjFile.closeSilently();
// check that DiskShare has not already been closed (seen on sentry)
if (smbjFile.getDiskShare().isConnected()) smbjFile.closeSilently();
}});
return oos;
}
Expand Down

0 comments on commit 63d0f23

Please sign in to comment.