Commit 208a7418 by Ryan Baxter Committed by GitHub

Merge pull request #1732 from utsman/master

Refactor ZoneUtils class
parents c0fefc4d c953d59b
...@@ -30,15 +30,8 @@ public class ZoneUtils { ...@@ -30,15 +30,8 @@ public class ZoneUtils {
* @return The approximate zone * @return The approximate zone
*/ */
public static String extractApproximateZone(String host) { public static String extractApproximateZone(String host) {
if (!host.contains(".")) {
return host;
}
String[] split = StringUtils.split(host, "."); String[] split = StringUtils.split(host, ".");
StringBuilder builder = new StringBuilder(split[1]); return split == null ? host : split[1];
for (int i = 2; i < split.length; i++) {
builder.append(".").append(split[i]);
}
return builder.toString();
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment