修复了mybait-plus在修改与添加时报错:字符集错误,原因,在使用以上方法时会调用类型转换接口但并不会使用默认字符集,而是给null

master
面包骑士 2024-08-22 20:29:27 +08:00
parent 47e3b92bbd
commit f38c958804
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,6 @@
package com.muyu.common.core.text;
import com.muyu.common.core.constant.Constants;
import com.muyu.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@ -689,11 +690,9 @@ public class Convert {
* @return
*/
public static String str (Object obj, String charsetName) {
System.out.println(obj);
try{
return str(obj, Charset.forName(charsetName));
return str(obj, Charset.forName(charsetName.isEmpty()? Constants.UTF8 : charsetName));
}catch (Exception exception){
System.out.println("字符转换异常: [{"+obj+"}-{"+charsetName+"}] -> {"+exception.getMessage()+"}");
log.error("字符转换异常: [{}-{}] -> {}",obj,charsetName,exception.getMessage(),exception);
throw new RuntimeException(exception);
}