This repository was archived by the owner on Oct 15, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
app/src/main/java/app/passwordstore/util/services
crypto/pgpainless/src/main/kotlin/app/passwordstore/crypto Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -89,7 +89,10 @@ class PasswordExportService : Service() {
89
89
val destOutputStream = contentResolver.openOutputStream(targetPasswordFile.uri)
90
90
91
91
if (destOutputStream != null && sourceInputStream != null ) {
92
- sourceInputStream.use { source -> destOutputStream.use { dest -> source.copyTo(dest) } }
92
+ sourceInputStream.copyTo(destOutputStream, 1024 )
93
+
94
+ sourceInputStream.close()
95
+ destOutputStream.close()
93
96
}
94
97
}
95
98
}
Original file line number Diff line number Diff line change @@ -65,7 +65,8 @@ public class PGPainlessCryptoHandler @Inject constructor() :
65
65
.addDecryptionKeys(keyringCollection, protector)
66
66
.addDecryptionPassphrase(Passphrase .fromPassword(passphrase))
67
67
)
68
- decryptionStream.use { Streams .pipeAll(it, outputStream) }
68
+ Streams .pipeAll(decryptionStream, outputStream)
69
+ decryptionStream.close()
69
70
return @runCatching
70
71
}
71
72
.mapError { error ->
@@ -120,7 +121,8 @@ public class PGPainlessCryptoHandler @Inject constructor() :
120
121
.setAsciiArmor(options.isOptionEnabled(PGPEncryptOptions .ASCII_ARMOR ))
121
122
val encryptionStream =
122
123
PGPainless .encryptAndOrSign().onOutputStream(outputStream).withOptions(producerOptions)
123
- encryptionStream.use { Streams .pipeAll(plaintextStream, it) }
124
+ Streams .pipeAll(plaintextStream, encryptionStream)
125
+ encryptionStream.close()
124
126
val result = encryptionStream.result
125
127
publicKeyRingCollection.forEach { keyRing ->
126
128
require(result.isEncryptedFor(keyRing)) {
You can’t perform that action at this time.
0 commit comments