From 23b0c5e5fc74bf54eab6c830f4cd34a5ed411e65 Mon Sep 17 00:00:00 2001 From: usbharu <64310155+usbharu@users.noreply.github.com> Date: Mon, 29 Jan 2024 11:17:58 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20JSON=E3=81=AE=E3=83=87=E3=82=B7?= =?UTF-8?q?=E3=83=AA=E3=82=A2=E3=83=A9=E3=82=A4=E3=82=BA=E3=81=AB=E5=A4=B1?= =?UTF-8?q?=E6=95=97=E3=81=97=E3=81=9F=E3=81=A8=E3=81=8D=E3=83=AD=E3=82=B0?= =?UTF-8?q?=E3=82=92=E5=87=BA=E3=81=99=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activitypub/service/inbox/InboxJobProcessor.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/inbox/InboxJobProcessor.kt b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/inbox/InboxJobProcessor.kt index fbe38266..48bbbfe1 100644 --- a/src/main/kotlin/dev/usbharu/hideout/activitypub/service/inbox/InboxJobProcessor.kt +++ b/src/main/kotlin/dev/usbharu/hideout/activitypub/service/inbox/InboxJobProcessor.kt @@ -1,5 +1,6 @@ package dev.usbharu.hideout.activitypub.service.inbox +import com.fasterxml.jackson.core.JsonParseException import com.fasterxml.jackson.databind.ObjectMapper import com.fasterxml.jackson.module.kotlin.readValue import dev.usbharu.hideout.activitypub.domain.model.objects.Object @@ -119,7 +120,12 @@ class InboxJobProcessor( throw IllegalStateException("ActivityPubProcessor not found. type: ${param.type}") } - val value = objectMapper.treeToValue(jsonNode, activityPubProcessor.type()) + val value = try { + objectMapper.treeToValue(jsonNode, activityPubProcessor.type()) + } catch (e: JsonParseException) { + logger.warn("Invalid JSON\n\n{}\n\n", jsonNode.toPrettyString()) + throw e + } activityPubProcessor.process(ActivityPubProcessContext(value, jsonNode, httpRequest, signature, verify)) logger.info("SUCCESS Process inbox. type: {}", param.type)