feat(): 字符集异常

master
yangpeng 2024-08-09 11:50:39 +08:00
parent c14ce4c1ba
commit f3a4d430f4
9 changed files with 20 additions and 11 deletions

View File

@ -3,7 +3,7 @@ package com.muyu.common.core.enums;
import java.util.Arrays; import java.util.Arrays;
/** /**
* @Author: zi run * @Author: by
* @Date 2024/8/5 19:01 * @Date 2024/8/5 19:01
* @Description * @Description
*/ */

View File

@ -3,7 +3,7 @@ package com.muyu.common.core.enums;
import java.util.Arrays; import java.util.Arrays;
/** /**
* @Author: zi run * @Author: by
* @Date 2024/8/4 14:09 * @Date 2024/8/4 14:09
* @Description * @Description
*/ */

View File

@ -1,9 +1,9 @@
package com.muyu.common.core.enums; package com.muyu.common.core.enums;
/** /**
* * @Description
* * @Author: by
* @author muyu * @Date 2024/8/4 14:09
*/ */
public enum UserStatus { public enum UserStatus {
OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除"); OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");

View File

@ -1,6 +1,8 @@
package com.muyu.common.core.text; package com.muyu.common.core.text;
import com.muyu.common.core.utils.StringUtils; import com.muyu.common.core.utils.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger; import java.math.BigInteger;
@ -16,6 +18,8 @@ import java.util.Set;
* @author muyu * @author muyu
*/ */
public class Convert { public class Convert {
private static final Logger log = LoggerFactory.getLogger(Convert.class);
/** /**
* <br> * <br>
* null<br> * null<br>
@ -687,7 +691,12 @@ public class Convert {
* @return * @return
*/ */
public static String str (Object obj, String charsetName) { public static String str (Object obj, String charsetName) {
return str(obj, Charset.forName(charsetName)); try {
return str(obj, CharsetKit.charset(charsetName));//字符集
}catch (Exception exception){
log.error("字符集转换异常:[{}--{}]->{}",obj,charsetName,exception.getMessage(),exception);
throw new RuntimeException(exception);
}
} }
/** /**

View File

@ -11,4 +11,4 @@ public class ValidationConfig {
public Validator validator() { public Validator validator() {
return Validation.byDefaultProvider().configure().buildValidatorFactory().getValidator(); return Validation.byDefaultProvider().configure().buildValidatorFactory().getValidator();
} }
} }

View File

@ -9,7 +9,7 @@ import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* @Author: zi run * @Author: by
* @Date 2024/8/5 19:33 * @Date 2024/8/5 19:33
* @Description validation * @Description validation
*/ */

View File

@ -11,7 +11,7 @@ import java.lang.annotation.Target;
import static java.lang.annotation.RetentionPolicy.RUNTIME; import static java.lang.annotation.RetentionPolicy.RUNTIME;
/** /**
* @Author: zi run * @Author: by
* @Date 2024/8/4 14:25 * @Date 2024/8/4 14:25
* @Description validation * @Description validation
*/ */

View File

@ -5,7 +5,7 @@ import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;
/** /**
* @Author: zi run * @Author: by
* @Date 2024/8/5 19:33 * @Date 2024/8/5 19:33
* @Description * @Description
*/ */

View File

@ -5,7 +5,7 @@ import jakarta.validation.ConstraintValidator;
import jakarta.validation.ConstraintValidatorContext; import jakarta.validation.ConstraintValidatorContext;
/** /**
* @Author: zi run * @Author: by
* @Date 2024/8/4 14:31 * @Date 2024/8/4 14:31
* @Description * @Description
*/ */