static String mapHostToRealm(String name) { String result = null; try { String subname = null; Config c = Config.getInstance(); if ((result = c.get("domain_realm", name)) != null) return result; else { for (int i = 1; i < name.length(); i++) { if ((name.charAt(i) == '.') && (i != name.length() - 1)) { // mapping could be .ibm.com = AUSTIN.IBM.COM subname = name.substring(i); result = c.get("domain_realm", subname); if (result != null) { break; } else { subname = name.substring(i + 1); // or mapping could be ibm.com = AUSTIN.IBM.COM result = c.get("domain_realm", subname); if (result != null) { break; } } } } } } catch (KrbException e) { } return result; }