diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/juick/ActivityPubManager.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index 22fe826f..61431c71 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -61,6 +61,7 @@ import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.NoSuchElementException; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -186,15 +187,17 @@ public class ActivityPubManager implements ActivityListener, NotificationListene User user = event.getUser(); String userUri = personUri(user); Person me = (Person) signatureManager.getContext(URI.create(userUri)).get(); - socialService.getFollowers(user).forEach(acct -> { - Person follower = (Person) signatureManager.getContext(URI.create(acct)).get(); - Update update = new Update(); - update.setId(objectUri + "#update"); - update.setActor(me.getId()); - update.setObject(objectUri); + socialService.getFollowers(user).forEach(acct -> { try { + Person follower = (Person) signatureManager.getContext(URI.create(acct)).orElseThrow(); + Update update = new Update(); + update.setId(objectUri + "#update"); + update.setActor(me.getId()); + update.setObject(objectUri); logger.info("Update to follower {}", follower.getId()); signatureManager.post(me, follower, update); + } catch (NoSuchElementException e) { + logger.warn("Person not verified: {}", acct); } catch (IOException | NoSuchAlgorithmException e) { logger.warn("activitypub exception", e); } |