SignalServiceAttachment attachment, AttachmentHandler consumer
) throws IOException {
if (attachment.isStream()) {
- try (var input = attachment.asStream().getInputStream()) {
- consumer.handle(input);
- }
+ var input = attachment.asStream().getInputStream();
+ // don't close input stream here, it might be reused later (e.g. with contact sync messages ...)
+ consumer.handle(input);
return;
}
sendHelper.sendSyncMessage(SignalServiceSyncMessage.forVerified(verifiedMessage));
}
- public void handleSyncDeviceContacts(final InputStream input) {
+ public void handleSyncDeviceContacts(final InputStream input) throws IOException {
final var s = new DeviceContactsInputStream(input);
DeviceContact c;
while (true) {
logger.warn("Sync contacts contained invalid contact, ignoring: {}", e.getMessage());
continue;
} else {
- logger.warn("Failed to read sync contacts", e);
- break;
+ throw e;
}
}
if (c == null) {