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 4944bf0a8a2d..0e07040a97c6 100644 --- a/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java +++ b/WordPressUtils/src/main/java/org/wordpress/android/util/BlogUtils.java @@ -6,19 +6,10 @@ public class BlogUtils { public static Comparator BlogNameComparator = new Comparator() { public int compare(Object blog1, Object blog2) { - Map blogMap1 = (Map) blog1; - Map blogMap2 = (Map) blog2; - - String blogName1 = MapUtils.getMapStr(blogMap1, "blogName"); - if (blogName1.length() == 0) { - blogName1 = MapUtils.getMapStr(blogMap1, "url"); - } - - String blogName2 = MapUtils.getMapStr(blogMap2, "blogName"); - if (blogName2.length() == 0) { - blogName2 = MapUtils.getMapStr(blogMap2, "url"); - } - + Map blogMap1 = (Map) blog1; + Map blogMap2 = (Map) blog2; + String blogName1 = getBlogNameOrHostNameFromAccountMap(blogMap1); + String blogName2 = getBlogNameOrHostNameFromAccountMap(blogMap2); return blogName1.compareToIgnoreCase(blogName2); } };