You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/08/06 04:47:37 UTC

[dubbo] branch 3.0 updated: Remove unused modifiable param (#8411)

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

albumenj pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git


The following commit(s) were added to refs/heads/3.0 by this push:
     new b680b53  Remove unused modifiable param (#8411)
b680b53 is described below

commit b680b533485bede110e0e7d1afd57a1f9a354f12
Author: 灼华 <43...@users.noreply.github.com>
AuthorDate: Fri Aug 6 12:47:29 2021 +0800

    Remove unused modifiable param (#8411)
    
    * Remove unused modifiable param
    
    * FIX ut
---
 .../src/main/java/org/apache/dubbo/common/URL.java   |  8 ++------
 .../java/org/apache/dubbo/common/URLStrParser.java   | 20 +++++---------------
 2 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
index 4b031fb..65ec401 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/URL.java
@@ -228,14 +228,10 @@ class URL implements Serializable {
      * @return
      */
     public static URL valueOf(String url, boolean encoded) {
-        return valueOf(url, encoded, false);
-    }
-
-    public static URL valueOf(String url, boolean encoded, boolean modifiable) {
         if (encoded) {
-            return URLStrParser.parseEncodedStr(url, modifiable);
+            return URLStrParser.parseEncodedStr(url);
         }
-        return URLStrParser.parseDecodedStr(url, modifiable);
+        return URLStrParser.parseDecodedStr(url);
     }
 
     public static URL valueOf(String url, String... reserveParams) {
diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/URLStrParser.java b/dubbo-common/src/main/java/org/apache/dubbo/common/URLStrParser.java
index 55ca88d..0dde194 100644
--- a/dubbo-common/src/main/java/org/apache/dubbo/common/URLStrParser.java
+++ b/dubbo-common/src/main/java/org/apache/dubbo/common/URLStrParser.java
@@ -16,8 +16,6 @@
  */
 package org.apache.dubbo.common;
 
-import org.apache.dubbo.common.logger.Logger;
-import org.apache.dubbo.common.logger.LoggerFactory;
 import org.apache.dubbo.common.url.component.ServiceConfigURL;
 import org.apache.dubbo.common.url.component.URLItemCache;
 
@@ -31,7 +29,6 @@ import static org.apache.dubbo.common.utils.StringUtils.decodeHexByte;
 import static org.apache.dubbo.common.utils.Utf8Utils.decodeUtf8;
 
 public final class URLStrParser {
-    private static final Logger logger = LoggerFactory.getLogger(URLStrParser.class);
     public static final String ENCODED_QUESTION_MARK = "%3F";
     public static final String ENCODED_TIMESTAMP_KEY = "timestamp%3D";
     public static final String ENCODED_PID_KEY = "pid%3D";
@@ -44,16 +41,13 @@ public final class URLStrParser {
         //empty
     }
 
-    public static URL parseDecodedStr(String decodedURLStr) {
-        return parseDecodedStr(decodedURLStr, false);
-    }
 
     /**
      * @param decodedURLStr : after {@link URL#decode} string
      *                      decodedURLStr format: protocol://username:password@host:port/path?k1=v1&k2=v2
      *                      [protocol://][username:password@][host:port]/[path][?k1=v1&k2=v2]
      */
-    public static URL parseDecodedStr(String decodedURLStr, boolean modifiable) {
+    public static URL parseDecodedStr(String decodedURLStr) {
         Map<String, String> parameters = null;
         int pathEndIdx = decodedURLStr.indexOf('?');
         if (pathEndIdx >= 0) {
@@ -63,7 +57,7 @@ public final class URLStrParser {
         }
 
         String decodedBody = decodedURLStr.substring(0, pathEndIdx);
-        return parseURLBody(decodedURLStr, decodedBody, parameters, modifiable);
+        return parseURLBody(decodedURLStr, decodedBody, parameters);
     }
 
     private static Map<String, String> parseDecodedParams(String str, int from) {
@@ -106,7 +100,7 @@ public final class URLStrParser {
      * @param parameters  :
      * @return URL
      */
-    private static URL parseURLBody(String fullURLStr, String decodedBody, Map<String, String> parameters, boolean modifiable) {
+    private static URL parseURLBody(String fullURLStr, String decodedBody, Map<String, String> parameters) {
         int starIdx = 0, endIdx = decodedBody.length();
         // ignore the url content following '#'
         int poundIndex = decodedBody.indexOf('#');
@@ -181,10 +175,6 @@ public final class URLStrParser {
         return new ServiceConfigURL(protocol, username, password, host, port, path, parameters);
     }
 
-    public static URL parseEncodedStr(String encodedURLStr) {
-        return parseEncodedStr(encodedURLStr, false);
-    }
-
     public static String[] parseRawURLToArrays(String rawURLStr, int pathEndIdx) {
         String[] parts = new String[2];
         int paramStartIdx = pathEndIdx + 3;//skip ENCODED_QUESTION_MARK
@@ -218,7 +208,7 @@ public final class URLStrParser {
      *                      encodedURLStr after decode format: protocol://username:password@host:port/path?k1=v1&k2=v2
      *                      [protocol://][username:password@][host:port]/[path][?k1=v1&k2=v2]
      */
-    public static URL parseEncodedStr(String encodedURLStr, boolean modifiable) {
+    public static URL parseEncodedStr(String encodedURLStr) {
         Map<String, String> parameters = null;
         int pathEndIdx = encodedURLStr.toUpperCase().indexOf("%3F");// '?'
         if (pathEndIdx >= 0) {
@@ -229,7 +219,7 @@ public final class URLStrParser {
 
         //decodedBody format: [protocol://][username:password@][host:port]/[path]
         String decodedBody = decodeComponent(encodedURLStr, 0, pathEndIdx, false, DECODE_TEMP_BUF.get());
-        return parseURLBody(encodedURLStr, decodedBody, parameters, modifiable);
+        return parseURLBody(encodedURLStr, decodedBody, parameters);
     }
 
     private static Map<String, String> parseEncodedParams(String str, int from) {