This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new a91d91f0f7f [chore](fe) Improve error msg about fe name format (#38195)
a91d91f0f7f is described below

commit a91d91f0f7ffe9c5ad12bdec17fdf7a3588f205c
Author: walter <[email protected]>
AuthorDate: Tue Jul 23 11:06:39 2024 +0800

    [chore](fe) Improve error msg about fe name format (#38195)
---
 .../src/main/java/org/apache/doris/common/ErrorCode.java       |  2 +-
 .../src/main/java/org/apache/doris/common/FeNameFormat.java    | 10 ++++++----
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
index c3864b45aa2..6b12532b2e6 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/ErrorCode.java
@@ -1115,7 +1115,7 @@ public enum ErrorCode {
     ERR_CLUSTER_ALTER_BE_IN_DECOMMISSION(5059, new byte[]{'4', '2', '0', '0', 
'0'},
             "Cluster '%s' has backends in decommission"),
     ERR_WRONG_NAME_FORMAT(5063, new byte[]{'4', '2', '0', '0', '0'},
-            "Incorrect %s name '%s'"),
+            "Incorrect %s name '%s', required format is '%s'"),
     ERR_COMMON_ERROR(5064, new byte[]{'4', '2', '0', '0', '0'},
             "%s"),
     ERR_COLOCATE_FEATURE_DISABLED(5063, new byte[]{'4', '2', '0', '0', '0'},
diff --git a/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java
index 493b61582fc..287d2368660 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/common/FeNameFormat.java
@@ -148,14 +148,16 @@ public class FeNameFormat {
     }
 
     public static void checkCommonName(String type, String name) throws 
AnalysisException {
-        if (Strings.isNullOrEmpty(name) || 
!name.matches(getCommonNameRegex())) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, 
name);
+        final String regex = getCommonNameRegex();
+        if (Strings.isNullOrEmpty(name) || !name.matches(regex)) {
+            
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, 
name, regex);
         }
     }
 
     public static void checkOutfileSuccessFileName(String type, String name) 
throws AnalysisException {
-        if (Strings.isNullOrEmpty(name) || 
!name.matches(getOutfileSuccessFileNameRegex())) {
-            
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, 
name);
+        final String regex = getOutfileSuccessFileNameRegex();
+        if (Strings.isNullOrEmpty(name) || !name.matches(regex)) {
+            
ErrorReport.reportAnalysisException(ErrorCode.ERR_WRONG_NAME_FORMAT, type, 
name, regex);
         }
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to