diff --git a/WordPressUtils/src/androidTest/java/org/wordpress/android/util/UrlUtilsTest.java b/WordPressUtils/src/androidTest/java/org/wordpress/android/util/UrlUtilsTest.java index b72e94821203..0b4ff2b62932 100644 --- a/WordPressUtils/src/androidTest/java/org/wordpress/android/util/UrlUtilsTest.java +++ b/WordPressUtils/src/androidTest/java/org/wordpress/android/util/UrlUtilsTest.java @@ -7,16 +7,16 @@ public class UrlUtilsTest extends InstrumentationTestCase { public void testGetDomainFromUrlWithEmptyStringDoesNotReturnNull() { - assertNotNull(UrlUtils.getDomainFromUrl("")); + assertNotNull(UrlUtils.getHost("")); } public void testGetDomainFromUrlWithNoHostDoesNotReturnNull() { - assertNotNull(UrlUtils.getDomainFromUrl("wordpress")); + assertNotNull(UrlUtils.getHost("wordpress")); } public void testGetDomainFromUrlWithHostReturnsHost() { String url = "http://www.wordpress.com"; - String host = UrlUtils.getDomainFromUrl(url); + String host = UrlUtils.getHost(url); assertTrue(host.equals("www.wordpress.com")); } diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java index 685aabf9ec53..0d21c0c2f1f2 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java @@ -40,7 +40,7 @@ public static String getHomeURLOrHostNameFromAccountMap(Map acco homeURL = StringUtils.removeTrailingSlash(homeURL); if (homeURL.length() == 0) { - return StringUtils.getHost(MapUtils.getMapStr(account, "url")); + return UrlUtils.getHost(MapUtils.getMapStr(account, "url")); } return homeURL; diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java index 7ce327072659..1fbfb3e56025 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/GravatarUtils.java @@ -77,7 +77,7 @@ public static String blavatarFromUrl(final String url, int size) { } public static String blavatarFromUrl(final String url, int size, DefaultImage defaultImage) { return "http://gravatar.com/blavatar/" - + StringUtils.getMd5Hash(UrlUtils.getDomainFromUrl(url)) + + StringUtils.getMd5Hash(UrlUtils.getHost(url)) + "?d=" + defaultImage.toString() + "&size=" + Integer.toString(size); } diff --git a/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java b/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java index f4b5756d25ee..3a0d7fd59a28 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/UrlUtils.java @@ -34,18 +34,16 @@ public static String urlDecode(final String text) { } /** - * - * @param urlString url to get domain from - * @return domain of uri if available. Empty string otherwise. + * @param urlString url to get host from + * @return host of uri if available. Empty string otherwise. */ - public static String getDomainFromUrl(final String urlString) { + public static String getHost(final String urlString) { if (urlString != null) { Uri uri = Uri.parse(urlString); if (uri.getHost() != null) { return uri.getHost(); } } - return ""; }