From 92850503e98c732d3e78123489505c0bdc7dbabd Mon Sep 17 00:00:00 2001 From: guoaomen Date: Wed, 6 Sep 2023 16:56:22 +0800 Subject: [PATCH] [inner-1787] fix: statement insertion errors --- .../information/tables/DbleDbInstance.java | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/actiontech/dble/services/manager/information/tables/DbleDbInstance.java b/src/main/java/com/actiontech/dble/services/manager/information/tables/DbleDbInstance.java index c8d8f64980..51a8677c41 100644 --- a/src/main/java/com/actiontech/dble/services/manager/information/tables/DbleDbInstance.java +++ b/src/main/java/com/actiontech/dble/services/manager/information/tables/DbleDbInstance.java @@ -482,21 +482,23 @@ public static String getPasswordEncrypt(String instanceName, String name, String } private void checkChineseProperty(String val, String name) { - if (StringUtil.isBlank(val)) { - throw new ConfigException("Column [ " + name + " ] " + val + " is illegal, the value not be null or empty"); - } - int length = 11; - if (val.length() > length) { - throw new ConfigException("Column [ " + name + " ] " + val + " is illegal, the value contains a maximum of " + length + " characters"); - } + if (Objects.nonNull(val)) { + if (StringUtil.isBlank(val)) { + throw new ConfigException("Column [ " + name + " ] " + val + " is illegal, the value not be null or empty"); + } + int length = 11; + if (val.length() > length) { + throw new ConfigException("Column [ " + name + " ] " + val + " is illegal, the value contains a maximum of " + length + " characters"); + } - String chinese = val.replaceAll(XMLDbLoader.PATTERN_DB.toString(), ""); - if (Strings.isNullOrEmpty(chinese)) { - return; - } + String chinese = val.replaceAll(XMLDbLoader.PATTERN_DB.toString(), ""); + if (Strings.isNullOrEmpty(chinese)) { + return; + } - if (!StringUtil.isChinese(chinese)) { - throw new ConfigException("Column [ " + name + " ] " + val + " is illegal,the " + Charset.defaultCharset().name() + " encoding is recommended, Column [ " + name + " ] show be use u4E00-u9FA5a-zA-Z_0-9\\-\\."); + if (!StringUtil.isChinese(chinese)) { + throw new ConfigException("Column [ " + name + " ] " + val + " is illegal,the " + Charset.defaultCharset().name() + " encoding is recommended, Column [ " + name + " ] show be use u4E00-u9FA5a-zA-Z_0-9\\-\\."); + } } }