From 1e82cb7125e4aa81dcbafa4746af1f0f9651b8c1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 19 Jan 2023 21:11:53 +0300 Subject: Cleanup logging --- src/main/java/com/juick/ActivityPubManager.java | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/juick/ActivityPubManager.java b/src/main/java/com/juick/ActivityPubManager.java index 922ab002..5f42028f 100644 --- a/src/main/java/com/juick/ActivityPubManager.java +++ b/src/main/java/com/juick/ActivityPubManager.java @@ -203,12 +203,11 @@ public class ActivityPubManager implements ActivityListener, NotificationListene socialService.getFollowers(user).forEach(acct -> { var context = activityPubService.get(URI.create(acct)); context.ifPresentOrElse((follower) -> { - if (follower instanceof Actor) { - var to = (Actor) follower; + if (follower instanceof Actor to) { try { activityPubService.post(from, to, activity); } catch (Exception e) { - logger.warn("Delivery to {} failed: {}", to, e.getMessage()); + logger.warn("Delivery to {} failed: {}", to.getId(), e.getMessage()); } } else { try { @@ -258,8 +257,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene if (!acct.equals(profileUriBuilder.followersUri(user))) { var context = activityPubService.get(URI.create(acct)); context.ifPresentOrElse((follower) -> { - if (follower instanceof Actor) { - var to = (Actor) follower; + if (follower instanceof Actor to) { Create create = new Create(); create.setId(note.getId()); create.setActor(me.getId()); @@ -268,7 +266,7 @@ public class ActivityPubManager implements ActivityListener, NotificationListene try { activityPubService.post(me, to, create); } catch (InterruptedException | IOException | NoSuchAlgorithmException e) { - logger.warn("Delivery to {} failed: {}", to, e.getMessage()); + logger.warn("Delivery to {} failed: {}", to.getId(), e.getMessage()); } } else { try { -- cgit v1.2.3