weichao666 commented on a change in pull request #651: [SCB-498] Configuration Center ip address need to config default port URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/651#discussion_r182673233
########## File path: foundations/foundation-common/src/main/java/org/apache/servicecomb/foundation/common/net/NetUtils.java ########## @@ -145,12 +145,25 @@ public static IpPort parseIpPortFromURI(String uriAddress) { try { URI uri = new URI(uriAddress); String authority = uri.getAuthority(); - return parseIpPort(authority); + return parseIpPort(uri.getScheme(), authority); } catch (URISyntaxException e) { return null; } } + private static IpPort parseIpPort(String scheme, String authority) { + if (authority == null) + return null; + int idx = authority.indexOf(':'); + if (idx != -1) + return parseIpPort(authority); + if (scheme.equals("http")) + return parseIpPort(new StringBuffer(authority).append(":80").toString()); + if (scheme.equals("https")) + return parseIpPort(new StringBuffer(authority).append(":443").toString()); + return parseIpPort(authority); Review comment: only http and https was deal with here, if it's starts with others, e.g "rest://",shouldn't return null ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services