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

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


The following commit(s) were added to refs/heads/master by this push:
     new 3595d8e890f Refactor BootstrapArguments (#34344)
3595d8e890f is described below

commit 3595d8e890fe20f7570c0d0cb14f894d353e420c
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jan 13 20:46:24 2025 +0800

    Refactor BootstrapArguments (#34344)
---
 .../proxy/arguments/BootstrapArguments.java        | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
index f8a2dd37703..91e01184384 100644
--- 
a/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
+++ 
b/proxy/bootstrap/src/main/java/org/apache/shardingsphere/proxy/arguments/BootstrapArguments.java
@@ -70,6 +70,17 @@ public final class BootstrapArguments {
         return args.length < 2 ? DEFAULT_CONFIG_PATH : 
paddingWithSlash(args[1]);
     }
     
+    private String paddingWithSlash(final String pathArg) {
+        StringBuilder result = new StringBuilder(pathArg);
+        if (!pathArg.startsWith("/")) {
+            result.insert(0, '/');
+        }
+        if (!pathArg.endsWith("/")) {
+            result.append('/');
+        }
+        return result.toString();
+    }
+    
     /**
      * Get bind address list.
      *
@@ -79,8 +90,7 @@ public final class BootstrapArguments {
         if (args.length < 3) {
             return Collections.singletonList(DEFAULT_BIND_ADDRESS);
         }
-        List<String> addresses = Arrays.asList(args[2].split(","));
-        return 
addresses.stream().filter(InetAddresses::isInetAddress).collect(Collectors.toList());
+        return 
Arrays.stream(args[2].split(",")).filter(InetAddresses::isInetAddress).collect(Collectors.toList());
     }
     
     /**
@@ -96,17 +106,6 @@ public final class BootstrapArguments {
         return addresses.stream().filter(address -> 
!InetAddresses.isInetAddress(address)).filter(this::isValidPath).findFirst();
     }
     
-    private String paddingWithSlash(final String pathArg) {
-        StringBuilder result = new StringBuilder(pathArg);
-        if (!pathArg.startsWith("/")) {
-            result.insert(0, '/');
-        }
-        if (!pathArg.endsWith("/")) {
-            result.append('/');
-        }
-        return result.toString();
-    }
-    
     private boolean isValidPath(final String path) {
         try {
             Paths.get(path);

Reply via email to