Merge pull request #1732 from utsman/master

Refactor ZoneUtils class
This commit is contained in:
Ryan Baxter
2017-02-27 09:40:49 -05:00
committed by GitHub

View File

@@ -30,15 +30,8 @@ public class ZoneUtils {
* @return The approximate zone
*/
public static String extractApproximateZone(String host) {
if (!host.contains(".")) {
return host;
}
String[] split = StringUtils.split(host, ".");
StringBuilder builder = new StringBuilder(split[1]);
for (int i = 2; i < split.length; i++) {
builder.append(".").append(split[i]);
}
return builder.toString();
return split == null ? host : split[1];
}
}