Skip to content

Commit a5efa15

Browse files
committed
s/getDomainFromUri/getHost/
1 parent e395732 commit a5efa15

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

WordPressUtils/src/androidTest/java/org/wordpress/android/util/UrlUtilsTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@
77

88
public class UrlUtilsTest extends InstrumentationTestCase {
99
public void testGetDomainFromUrlWithEmptyStringDoesNotReturnNull() {
10-
assertNotNull(UrlUtils.getDomainFromUrl(""));
10+
assertNotNull(UrlUtils.getHost(""));
1111
}
1212

1313
public void testGetDomainFromUrlWithNoHostDoesNotReturnNull() {
14-
assertNotNull(UrlUtils.getDomainFromUrl("wordpress"));
14+
assertNotNull(UrlUtils.getHost("wordpress"));
1515
}
1616

1717
public void testGetDomainFromUrlWithHostReturnsHost() {
1818
String url = "http://www.wordpress.com";
19-
String host = UrlUtils.getDomainFromUrl(url);
19+
String host = UrlUtils.getHost(url);
2020

2121
assertTrue(host.equals("www.wordpress.com"));
2222
}

WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public static String getHomeURLOrHostNameFromAccountMap(Map<String, Object> acco
4040
homeURL = StringUtils.removeTrailingSlash(homeURL);
4141

4242
if (homeURL.length() == 0) {
43-
return StringUtils.getHost(MapUtils.getMapStr(account, "url"));
43+
return UrlUtils.getHost(MapUtils.getMapStr(account, "url"));
4444
}
4545

4646
return homeURL;

WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public static String blavatarFromUrl(final String url, int size) {
7777
}
7878
public static String blavatarFromUrl(final String url, int size, DefaultImage defaultImage) {
7979
return "http://gravatar.com/blavatar/"
80-
+ StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url))
80+
+ StringUtils.getMd5Hash(UrlUtils.getHost(url))
8181
+ "?d=" + defaultImage.toString()
8282
+ "&size=" + Integer.toString(size);
8383
}

WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,16 @@ public static String urlDecode(final String text) {
3434
}
3535

3636
/**
37-
*
38-
* @param urlString url to get domain from
39-
* @return domain of uri if available. Empty string otherwise.
37+
* @param urlString url to get host from
38+
* @return host of uri if available. Empty string otherwise.
4039
*/
41-
public static String getDomainFromUrl(final String urlString) {
40+
public static String getHost(final String urlString) {
4241
if (urlString != null) {
4342
Uri uri = Uri.parse(urlString);
4443
if (uri.getHost() != null) {
4544
return uri.getHost();
4645
}
4746
}
48-
4947
return "";
5048
}
5149

0 commit comments

Comments
 (0)