kopia lustrzana https://github.com/ryukoposting/Signal-Android
Revert "Always try to close the PartProvider open file pipe."
This reverts commit d97184ef60
.
fork-5.53.8
rodzic
dbddb274db
commit
a181ed0420
|
@ -157,27 +157,19 @@ public final class PartProvider extends BaseContentProvider {
|
||||||
ParcelFileDescriptor[] reliablePipe = ParcelFileDescriptor.createReliablePipe();
|
ParcelFileDescriptor[] reliablePipe = ParcelFileDescriptor.createReliablePipe();
|
||||||
|
|
||||||
SignalExecutors.BOUNDED_IO.execute(() -> {
|
SignalExecutors.BOUNDED_IO.execute(() -> {
|
||||||
Throwable error = null;
|
|
||||||
try (OutputStream out = new FileOutputStream(reliablePipe[1].getFileDescriptor())) {
|
try (OutputStream out = new FileOutputStream(reliablePipe[1].getFileDescriptor())) {
|
||||||
try (InputStream in = SignalDatabase.attachments().getAttachmentStream(attachmentId, 0)) {
|
try(InputStream in = SignalDatabase.attachments().getAttachmentStream(attachmentId, 0)) {
|
||||||
StreamUtil.copy(in, out);
|
StreamUtil.copy(in, out);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Error providing file", e);
|
Log.w(TAG, "Error providing file", e);
|
||||||
error = e;
|
try {
|
||||||
|
reliablePipe[1].closeWithError(e.getMessage());
|
||||||
|
} catch (IOException e2) {
|
||||||
|
Log.w(TAG, "Error closing pipe with error", e2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
Log.w(TAG, "Error opening pipe for writing", e);
|
Log.w(TAG, "Error opening pipe for writing", e);
|
||||||
error = e;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (error != null) {
|
|
||||||
reliablePipe[1].closeWithError("Error writing file: " + error.getMessage());
|
|
||||||
} else {
|
|
||||||
reliablePipe[1].close();
|
|
||||||
}
|
|
||||||
} catch (IOException e2) {
|
|
||||||
Log.w(TAG, "Error closing pipe", e2);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue