@Override
public void handleMessage(MessageEnvelope envelope, Throwable exception) {
+ synchronized (writer) {
+ handleMessageInternal(envelope, exception);
+ }
+ }
+
+ private void handleMessageInternal(MessageEnvelope envelope, Throwable exception) {
var source = envelope.sourceAddress();
writer.println("Envelope from: {} (device: {})",
source.map(this::formatContact).orElse("unknown source"),
if (attachment.width().isPresent() || attachment.height().isPresent()) {
writer.println("Dimensions: {}x{}", attachment.width().orElse(0), attachment.height().orElse(0));
}
- if (attachment.id().isPresent()) {
- var file = m.getAttachmentFile(attachment.id().get());
+ if (attachment.file().isPresent()) {
+ var file = attachment.file().get();
if (file.exists()) {
writer.println("Stored plaintext in: {}", file);
}