From 2b9d2478833a060df76c855e78c46e33c032db49 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 1 Nov 2018 13:29:29 +0300 Subject: ActivityPub: fix 410 error handler --- .../src/main/java/com/juick/server/SignatureManager.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'juick-server/src/main/java/com/juick/server/SignatureManager.java') diff --git a/juick-server/src/main/java/com/juick/server/SignatureManager.java b/juick-server/src/main/java/com/juick/server/SignatureManager.java index d43efd4a..927a62a7 100644 --- a/juick-server/src/main/java/com/juick/server/SignatureManager.java +++ b/juick-server/src/main/java/com/juick/server/SignatureManager.java @@ -89,15 +89,11 @@ public class SignatureManager { return false; } public Optional getContext(URI contextUri) { - try { - return Optional.of(apClient.getForEntity(contextUri, Context.class).getBody()); - } catch (HttpClientErrorException e) { + Context context = apClient.getForEntity(contextUri, Context.class).getBody(); + if (context == null) { logger.warn("Cannot identify {}", contextUri); - if (e.getStatusCode().equals(HttpStatus.GONE)) { - logger.warn("Server report {} is gone, deleting", contextUri); - applicationEventPublisher.publishEvent(new DeleteUserEvent(this, contextUri.toASCIIString())); - } + return Optional.empty(); } - return Optional.empty(); + return Optional.of(context); } } -- cgit v1.2.3