+ private void retryFailedReceivedMessage(final ReceiveMessageHandler handler, final boolean ignoreAttachments, final File fileEntry) {
+ SignalServiceEnvelope envelope;
+ try {
+ envelope = Utils.loadEnvelope(fileEntry);
+ if (envelope == null) {
+ return;
+ }
+ } catch (IOException e) {
+ e.printStackTrace();
+ return;
+ }
+ SignalServiceContent content = null;
+ if (!envelope.isReceipt()) {
+ try {
+ content = decryptMessage(envelope);
+ } catch (Exception e) {
+ return;
+ }
+ handleMessage(envelope, content, ignoreAttachments);
+ }
+ account.save();
+ handler.handleMessage(envelope, content, null);
+ try {
+ Files.delete(fileEntry.toPath());
+ } catch (IOException e) {
+ System.err.println("Failed to delete cached message file “" + fileEntry + "”: " + e.getMessage());
+ }
+ }
+