From 1e51320e728bb095ba15a58ffca19ef8b3d2e229 Mon Sep 17 00:00:00 2001 From: Number7 <1845377266@qq.com> Date: Thu, 8 Aug 2024 19:09:08 +0800 Subject: [PATCH] =?UTF-8?q?feat():=E5=AD=97=E7=AC=A6=E9=9B=86=E5=BC=82?= =?UTF-8?q?=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/muyu/common/core/text/Convert.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/muyu/common/core/text/Convert.java b/src/main/java/com/muyu/common/core/text/Convert.java index fb57cb9..927e46f 100644 --- a/src/main/java/com/muyu/common/core/text/Convert.java +++ b/src/main/java/com/muyu/common/core/text/Convert.java @@ -1,6 +1,7 @@ package com.muyu.common.core.text; import com.muyu.common.core.utils.StringUtils; +import lombok.extern.log4j.Log4j2; import java.math.BigDecimal; import java.math.BigInteger; @@ -15,6 +16,7 @@ import java.util.Set; * * @author muyu */ +@Log4j2 public class Convert { /** * 转换为字符串
@@ -687,7 +689,20 @@ public class Convert { * @return 字符串 */ public static String str (Object obj, String charsetName) { - return str(obj, Charset.forName(charsetName)); + + try{ + + return str(obj, Charset.forName(charsetName)); + + }catch (Exception exception){ + + + log.error("字符转换异常:[{}-{}] -> {}",obj,charsetName,exception.getMessage(),exception); + throw new RuntimeException(exception); + + } + + } /**