Skip to content

Commit

Permalink
DUBBO-537 UrlUtils不转换URL原生地址信息
Browse files Browse the repository at this point in the history
  • Loading branch information
liangfei0201 committed Aug 3, 2012
1 parent ccba3c8 commit e539b1e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.utils.NetUtils;
import com.alibaba.dubbo.common.utils.StringUtils;

public class UrlUtils {

Expand All @@ -44,7 +42,7 @@ public static URL parseURL(String address, Map<String, String> defaults) {
if (i > 1) {
backup.append(",");
}
backup.append(NetUtils.filterLocalHost(addresses[i]));
backup.append(addresses[i]);
}
url += "?" + Constants.BACKUP_KEY + "=" + backup.toString();
}
Expand Down Expand Up @@ -87,10 +85,10 @@ public static URL parseURL(String address, Map<String, String> defaults) {
changed = true;
password = defaultPassword;
}
if (u.isAnyHost() || u.isLocalHost()) {
/*if (u.isAnyHost() || u.isLocalHost()) {
changed = true;
host = NetUtils.getLocalHost();
}
}*/
if (port <= 0) {
if (defaultPort > 0) {
changed = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public class UrlUtilsTest {

String localAddress = NetUtils.getLocalHost();
String localAddress = "127.0.0.1";

@Test
public void testAddressNull() {
Expand Down Expand Up @@ -107,7 +107,7 @@ public void testParseUrl2() {
assertEquals("alibaba", url.getPassword());
assertEquals(10000, url.getPort());
assertEquals("dubbo", url.getProtocol());
assertEquals(localAddress + "," + localAddress, url.getParameter("backup"));
assertEquals("127.0.0.2" + "," + "127.0.0.3", url.getParameter("backup"));
}

@Test
Expand All @@ -120,7 +120,7 @@ public void testParseUrls() {
parameters.put("protocol", "dubbo");
List<URL> urls = UrlUtils.parseURLs(addresses, parameters);
assertEquals(localAddress + ":10000", urls.get(0).getAddress());
assertEquals(localAddress + ":10000", urls.get(1).getAddress());
assertEquals("127.0.0.2" + ":10000", urls.get(1).getAddress());
}

@Test
Expand Down

0 comments on commit e539b1e

Please sign in to comment.