From 422760dde74a6b5194ef068f93f8b532e29da6cf Mon Sep 17 00:00:00 2001 From: wlb <16316165+wlbcoder@user.noreply.gitee.com> Date: Wed, 15 Oct 2025 05:25:25 +0000 Subject: [PATCH] =?UTF-8?q?!241=20fix=20=E7=BF=BB=E8=AF=91=E6=97=B6?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4json=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E7=BB=93=E6=9E=84=E4=BD=93=E4=B8=8D=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E9=A2=84=E6=9C=9F=20*=20fix=20=E7=BF=BB=E8=AF=91=E6=97=B6?= =?UTF-8?q?=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4json=E5=BA=8F=E5=88=97?= =?UTF-8?q?=E5=8C=96=E7=BB=93=E6=9E=84=E4=BD=93=E4=B8=8D=E7=AC=A6=E5=90=88?= =?UTF-8?q?=E9=A2=84=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../translation/core/handler/TranslationHandler.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/handler/TranslationHandler.java b/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/handler/TranslationHandler.java index a90f1e1ec..e8c03acdc 100644 --- a/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/handler/TranslationHandler.java +++ b/ruoyi-common/ruoyi-common-translation/src/main/java/org/dromara/common/translation/core/handler/TranslationHandler.java @@ -46,8 +46,14 @@ public class TranslationHandler extends JsonSerializer implements Contex gen.writeNull(); return; } - Object result = trans.translation(value, translation.other()); - gen.writeObject(result); + try { + Object result = trans.translation(value, translation.other()); + gen.writeObject(result); + } catch (Exception e) { + log.error("翻译处理异常,type: {}, value: {}", translation.type(), value, e); + // 出现异常时输出原始值而不是中断序列化 + gen.writeObject(value); + } } else { gen.writeObject(value); }