You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampark.apache.org by be...@apache.org on 2023/11/30 05:13:51 UTC

(incubator-streampark) branch mvn_bug updated: [Improve] exception message improvement

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

benjobs pushed a commit to branch mvn_bug
in repository https://gitbox.apache.org/repos/asf/incubator-streampark.git


The following commit(s) were added to refs/heads/mvn_bug by this push:
     new ca42b8ab6 [Improve] exception message improvement
ca42b8ab6 is described below

commit ca42b8ab613785bb3e399143ce05f928ef0bd4b1
Author: benjobs <be...@gmail.com>
AuthorDate: Thu Nov 30 13:13:34 2023 +0800

    [Improve] exception message improvement
---
 .../streampark/console/core/entity/Project.java    | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
index d861c18a3..c65175f72 100644
--- a/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
+++ b/streampark-console/streampark-console-service/src/main/java/org/apache/streampark/console/core/entity/Project.java
@@ -22,7 +22,6 @@ import org.apache.streampark.common.conf.InternalConfigHolder;
 import org.apache.streampark.common.conf.Workspace;
 import org.apache.streampark.common.util.CommandUtils;
 import org.apache.streampark.common.util.Utils;
-import org.apache.streampark.console.base.exception.ApiAlertException;
 import org.apache.streampark.console.base.exception.ApiDetailException;
 import org.apache.streampark.console.base.util.GitUtils;
 import org.apache.streampark.console.base.util.WebUtils;
@@ -222,7 +221,7 @@ public class Project implements Serializable {
       } else {
         throw new IllegalArgumentException(
             String.format(
-                "Invalid build args, dangerous operator detected: %s, in your buildArgs: %s",
+                "Invalid build args, dangerous operation symbol detected: %s, in your buildArgs: %s",
                 dangerArgs.stream().collect(Collectors.joining(",")), this.buildArgs));
       }
     }
@@ -230,17 +229,19 @@ public class Project implements Serializable {
     String setting = InternalConfigHolder.get(CommonConfig.MAVEN_SETTINGS_PATH());
     if (StringUtils.isNotBlank(setting)) {
       List<String> dangerArgs = getLogicalOperators(setting);
-      ApiAlertException.throwIfTrue(
-          !dangerArgs.isEmpty(),
-          String.format(
-              "Invalid maven setting path, dangerous operator detected: %s, in your maven setting path: %s",
-              dangerArgs.stream().collect(Collectors.joining(",")), setting));
-      File file = new File(setting);
-      if (file.exists() && file.isFile()) {
-        cmdBuffer.append(" --settings ").append(setting);
+      if (dangerArgs.isEmpty()) {
+        File file = new File(setting);
+        if (file.exists() && file.isFile()) {
+          cmdBuffer.append(" --settings ").append(setting);
+        } else {
+          throw new IllegalArgumentException(
+              String.format("Invalid maven setting path, %s no exists or not file", setting));
+        }
       } else {
         throw new IllegalArgumentException(
-            String.format("Invalid maven setting path, %s no exists or not file", setting));
+            String.format(
+                "Invalid maven setting path, dangerous operation symbol detected: %s, in your maven setting path: %s",
+                dangerArgs.stream().collect(Collectors.joining(",")), setting));
       }
     }
     return cmdBuffer.toString();