From 055cda0267efd41678cf0dcdbefa7de821b3db23 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 14 Apr 2022 17:12:51 +0300 Subject: ActivityPub: handle followers exceptions --- src/main/java/com/juick/ActivityPubManager.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index b0e77c63..a86fc301 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -416,11 +416,15 @@ public class ActivityPubManager implements ActivityListener, NotificationListene socialService.getFollowers(user).forEach(acct -> { var follower = signatureManager.getContext(URI.create(acct)); follower.ifPresentOrElse((person) -> { - try { - logger.info("{} announcing {} to {}", user.getName(), message.getMid(), acct); - signatureManager.post((Actor)ctx, (Actor) person, announce); - } catch (IOException | NoSuchAlgorithmException e) { - logger.warn("activitypub exception", e); + if (person instanceof Actor) { + try { + logger.info("{} announcing {} to {}", user.getName(), message.getMid(), acct); + signatureManager.post((Actor) ctx, (Actor) person, announce); + } catch (IOException | NoSuchAlgorithmException e) { + logger.warn("activitypub exception", e); + } + } else { + logger.warn("Unhandled context: {}", acct); } }, () -> logger.warn("Follower not found: {}", acct)); }); -- cgit v1.2.3