mirror of
https://github.com/android-password-store/Android-Password-Store
synced 2025-08-22 18:07:19 +00:00
Revert "refactor: use Closeable#use
extension where applicable"
This reverts commit 69513bf24613d4ba540bcdeaffe04dc9330a65a4.
This commit is contained in:
parent
cb22561878
commit
04f4b9804f
@ -89,7 +89,10 @@ class PasswordExportService : Service() {
|
||||
val destOutputStream = contentResolver.openOutputStream(targetPasswordFile.uri)
|
||||
|
||||
if (destOutputStream != null && sourceInputStream != null) {
|
||||
sourceInputStream.use { source -> destOutputStream.use { dest -> source.copyTo(dest) } }
|
||||
sourceInputStream.copyTo(destOutputStream, 1024)
|
||||
|
||||
sourceInputStream.close()
|
||||
destOutputStream.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -65,7 +65,8 @@ public class PGPainlessCryptoHandler @Inject constructor() :
|
||||
.addDecryptionKeys(keyringCollection, protector)
|
||||
.addDecryptionPassphrase(Passphrase.fromPassword(passphrase))
|
||||
)
|
||||
decryptionStream.use { Streams.pipeAll(it, outputStream) }
|
||||
Streams.pipeAll(decryptionStream, outputStream)
|
||||
decryptionStream.close()
|
||||
return@runCatching
|
||||
}
|
||||
.mapError { error ->
|
||||
@ -120,7 +121,8 @@ public class PGPainlessCryptoHandler @Inject constructor() :
|
||||
.setAsciiArmor(options.isOptionEnabled(PGPEncryptOptions.ASCII_ARMOR))
|
||||
val encryptionStream =
|
||||
PGPainless.encryptAndOrSign().onOutputStream(outputStream).withOptions(producerOptions)
|
||||
encryptionStream.use { Streams.pipeAll(plaintextStream, it) }
|
||||
Streams.pipeAll(plaintextStream, encryptionStream)
|
||||
encryptionStream.close()
|
||||
val result = encryptionStream.result
|
||||
publicKeyRingCollection.forEach { keyRing ->
|
||||
require(result.isEncryptedFor(keyRing)) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user