From 56bbbb3dbe4c4f6302a898e5c9a4ac02791d1f35 Mon Sep 17 00:00:00 2001 From: AlexisLeDain Date: Thu, 9 Apr 2026 17:28:56 +0200 Subject: [PATCH] fix: handle checked JsonProcessingException in serializePayload writeValueAsString throws checked JsonProcessingException which was unhandled, causing a compile error. Wrapped in try/catch, rethrowing as IllegalStateException. --- docs/ja-JP/skills/quarkus-patterns/SKILL.md | 7 +++++-- docs/tr/skills/quarkus-patterns/SKILL.md | 7 +++++-- docs/zh-CN/skills/quarkus-patterns/SKILL.md | 7 +++++-- skills/quarkus-patterns/SKILL.md | 7 +++++-- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/ja-JP/skills/quarkus-patterns/SKILL.md b/docs/ja-JP/skills/quarkus-patterns/SKILL.md index 44a70a05..0c3664fe 100644 --- a/docs/ja-JP/skills/quarkus-patterns/SKILL.md +++ b/docs/ja-JP/skills/quarkus-patterns/SKILL.md @@ -185,8 +185,11 @@ public class EventService { } private String serializePayload(Object payload) { - // JSONシリアライゼーション - return objectMapper.writeValueAsString(payload); + try { + return objectMapper.writeValueAsString(payload); + } catch (JsonProcessingException e) { + throw new IllegalStateException("Failed to serialize event payload", e); + } } } ``` diff --git a/docs/tr/skills/quarkus-patterns/SKILL.md b/docs/tr/skills/quarkus-patterns/SKILL.md index 41445670..ec9f18cb 100644 --- a/docs/tr/skills/quarkus-patterns/SKILL.md +++ b/docs/tr/skills/quarkus-patterns/SKILL.md @@ -185,8 +185,11 @@ public class EventService { } private String serializePayload(Object payload) { - // JSON serileştirme - return objectMapper.writeValueAsString(payload); + try { + return objectMapper.writeValueAsString(payload); + } catch (JsonProcessingException e) { + throw new IllegalStateException("Failed to serialize event payload", e); + } } } ``` diff --git a/docs/zh-CN/skills/quarkus-patterns/SKILL.md b/docs/zh-CN/skills/quarkus-patterns/SKILL.md index 3a72e488..50af74a0 100644 --- a/docs/zh-CN/skills/quarkus-patterns/SKILL.md +++ b/docs/zh-CN/skills/quarkus-patterns/SKILL.md @@ -185,8 +185,11 @@ public class EventService { } private String serializePayload(Object payload) { - // JSON序列化 - return objectMapper.writeValueAsString(payload); + try { + return objectMapper.writeValueAsString(payload); + } catch (JsonProcessingException e) { + throw new IllegalStateException("Failed to serialize event payload", e); + } } } ``` diff --git a/skills/quarkus-patterns/SKILL.md b/skills/quarkus-patterns/SKILL.md index cde4e524..f6b415e2 100644 --- a/skills/quarkus-patterns/SKILL.md +++ b/skills/quarkus-patterns/SKILL.md @@ -187,8 +187,11 @@ public class EventService { } private String serializePayload(Object payload) { - // JSON serialization - return objectMapper.writeValueAsString(payload); + try { + return objectMapper.writeValueAsString(payload); + } catch (JsonProcessingException e) { + throw new IllegalStateException("Failed to serialize event payload", e); + } } } ```