operations: properly close FileOutputStream.

Classes that implement the Closeable interface or its super-interface, AutoCloseable, needs to be closed after use. try-with-resources does this for you automatically.

Signed-off-by: ardevd <edvard.holst@gmail.com>
Signed-off-by: nextcloud-android-bot <android@nextcloud.com>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
ardevd 2019-03-26 12:12:16 +01:00 committed by tobiasKaminsky
parent 23c9ea0cf4
commit c59b41d761
No known key found for this signature in database
GPG key ID: 0E00D4D47D0C5AF7
2 changed files with 4 additions and 3 deletions

View file

@ -1 +1 @@
474 473

View file

@ -203,8 +203,9 @@ public class DownloadFileOperation extends RemoteOperation {
try { try {
byte[] decryptedBytes = EncryptionUtils.decryptFile(tmpFile, key, iv, authenticationTag); byte[] decryptedBytes = EncryptionUtils.decryptFile(tmpFile, key, iv, authenticationTag);
FileOutputStream fileOutputStream = new FileOutputStream(tmpFile); try (FileOutputStream fileOutputStream = new FileOutputStream(tmpFile)) {
fileOutputStream.write(decryptedBytes); fileOutputStream.write(decryptedBytes);
}
} catch (Exception e) { } catch (Exception e) {
return new RemoteOperationResult(e); return new RemoteOperationResult(e);
} }