CrazyHZM commented on a change in pull request #9060: URL: https://github.com/apache/dubbo/pull/9060#discussion_r733331411
########## File path: dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java ########## @@ -65,8 +66,8 @@ private static final String URL_PARAM_STARTING_SYMBOL = "?"; public static URL parseURL(String address, Map<String, String> defaults) { - if (address == null || address.length() == 0) { - return null; + if (StringUtils.isEmpty(address)) { + throw new IllegalArgumentException("Address is not allowed to be empty, please re-enter."); Review comment: remove description of `please re-enter.` ########## File path: dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java ########## @@ -162,22 +163,22 @@ public static URL parseURL(String address, Map<String, String> defaults) { } public static List<URL> parseURLs(String address, Map<String, String> defaults) { - if (address == null || address.length() == 0) { - return null; + if (StringUtils.isEmpty(address)) { + throw new IllegalArgumentException("Address is not allowed to be empty, please re-enter."); } String[] addresses = REGISTRY_SPLIT_PATTERN.split(address); if (addresses == null || addresses.length == 0) { - return null; //here won't be empty + throw new IllegalArgumentException("Addresses is not allowed to be empty, please re-enter."); //here won't be empty Review comment: remove description of `please re-enter.` ########## File path: dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java ########## @@ -43,7 +43,12 @@ @Test public void testAddressNull() { - assertNull(UrlUtils.parseURL(null, null)); + String exceptionMessage = "Address is not allowed to be empty, please re-enter."; Review comment: Modify it together. ########## File path: dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java ########## @@ -133,7 +138,12 @@ public void testParseUrls() { @Test public void testParseUrlsAddressNull() { - assertNull(UrlUtils.parseURLs(null, null)); + String exceptionMessage = "Address is not allowed to be empty, please re-enter."; Review comment: Modify it together. ########## File path: dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java ########## @@ -162,22 +163,22 @@ public static URL parseURL(String address, Map<String, String> defaults) { } public static List<URL> parseURLs(String address, Map<String, String> defaults) { - if (address == null || address.length() == 0) { - return null; + if (StringUtils.isEmpty(address)) { + throw new IllegalArgumentException("Address is not allowed to be empty, please re-enter."); Review comment: remove description of `please re-enter.` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@dubbo.apache.org For additional commands, e-mail: notifications-h...@dubbo.apache.org