+ int dotIndex = hostname.indexOf('.');
+ if (dotIndex <= 0) {
+ hostname = localhost.getCanonicalHostName();
+ dotIndex = hostname.indexOf('.');
+ if (dotIndex <= 0)
+ throw new IllegalArgumentException(
+ "Cannot extract DNS zone from hostname " + hostname + " (" + localhost + ")");
+ }
+ String dnsZone = hostname.substring(dotIndex + 1);