From f8612eb52e1aa9b3c613edd8e7bb595895243e33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 15 Oct 2025 13:31:24 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E7=BF=BB=E8=AF=91?= =?UTF-8?q?=E6=97=B6=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4json=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E5=8C=96=E7=BB=93=E6=9E=84=E4=BD=93=E4=B8=8D=E7=AC=A6?= =?UTF-8?q?=E5=90=88=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); }