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

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


The following commit(s) were added to refs/heads/dev-2.1.2 by this push:
     new 88cedb11f [Improve] method extractArguments improvement
88cedb11f is described below

commit 88cedb11f7bc308b8f2e6d20ef1e053e60fb990d
Author: benjobs <[email protected]>
AuthorDate: Thu Oct 26 23:27:37 2023 +0800

    [Improve] method extractArguments improvement
---
 .../streampark/common/util/PropertiesUtils.scala   | 39 ++++++----------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git 
a/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
 
b/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
index 2272cc5cf..cf35f61b2 100644
--- 
a/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
+++ 
b/streampark-common/src/main/scala/org/apache/streampark/common/util/PropertiesUtils.scala
@@ -310,36 +310,19 @@ object PropertiesUtils extends Logger {
     if (StringUtils.isNotEmpty(args)) {
       val array = args.split("\\s+")
       val iter = array.iterator
-      def join(s: String, v: String): Unit = {
-        if (v.startsWith(s)) {
-          if (v.endsWith(s)) {
-            programArgs += v.replaceAll(s"^$s|$s$$", "")
-          } else {
-            var value = v
-            while (!value.endsWith(s) && iter.hasNext) {
-              value += s" ${iter.next()}"
-            }
-            programArgs += value.replaceAll(s"^$s|$s$$", "")
-          }
-        }
-      }
-
       while (iter.hasNext) {
         val v = iter.next()
-        if (v.startsWith("'")) {
-          if (v.endsWith("'")) {
-            programArgs += v.replaceAll("^'|'$", "")
-          } else {
-            join("'", v)
-          }
-        } else if (v.startsWith("\"")) {
-          if (v.endsWith("\"")) {
-            programArgs += v.replaceAll("^\"|\"$", "")
-          } else {
-            join("\"", v)
-          }
-        } else {
-          programArgs += v
+        val p = v.take(1)
+        p match {
+          case "'" | "\"" =>
+            var value = v
+            if (!v.endsWith(p)) {
+              while (!value.endsWith(p) && iter.hasNext) {
+                value += s" ${iter.next()}"
+              }
+            }
+            programArgs += value.replaceAll(s"^$p|$p$$", "")
+          case _ => programArgs += v
         }
       }
     }

Reply via email to