@Test public void testIsArpaTldAndLabelIsValid() { assertTrue(DomainUtil .isArpaTldAndLabelIsValid("1.1.1.d.a.c.a.0.ip6.arpa")); for (String domain : validArpaDomain) { assertTrue(DomainUtil.isArpaTldAndLabelIsValid(domain)); } for (String domain : inValidArpaDomain) { assertFalse(DomainUtil.isArpaTldAndLabelIsValid(domain)); } assertTrue(DomainUtil.isArpaTldAndLabelIsValid("arpa.")); assertTrue(DomainUtil.isArpaTldAndLabelIsValid("arpa")); assertTrue(DomainUtil.isArpaTldAndLabelIsValid("cnnic.cn")); assertTrue(DomainUtil.isArpaTldAndLabelIsValid(" cnnic.cn")); assertTrue(DomainUtil.isArpaTldAndLabelIsValid(".")); assertTrue(DomainUtil.isArpaTldAndLabelIsValid("cnnic.cn")); }
public static boolean isArpaTldAndLabelIsValid(String domainName) { String domainWithoutLastPoint = deleteLastPoint(domainName); if (StringUtils.isBlank(domainWithoutLastPoint)) { return false; } if (!domainWithoutLastPoint.endsWith(ARPA_SUFFIX)) { return true; } domainWithoutLastPoint = StringUtils.lowerCase(domainWithoutLastPoint); if (isIpV4ArpaTldAndLabelIsValid(domainWithoutLastPoint) || isIpV6ArpaTldAndLabelIsValid(domainWithoutLastPoint)) { return true; } return false; }
DomainUtil { public static boolean isArpaTldAndLabelIsValid(String domainName) { String domainWithoutLastPoint = deleteLastPoint(domainName); if (StringUtils.isBlank(domainWithoutLastPoint)) { return false; } if (!domainWithoutLastPoint.endsWith(ARPA_SUFFIX)) { return true; } domainWithoutLastPoint = StringUtils.lowerCase(domainWithoutLastPoint); if (isIpV4ArpaTldAndLabelIsValid(domainWithoutLastPoint) || isIpV6ArpaTldAndLabelIsValid(domainWithoutLastPoint)) { return true; } return false; } }
DomainUtil { public static boolean isArpaTldAndLabelIsValid(String domainName) { String domainWithoutLastPoint = deleteLastPoint(domainName); if (StringUtils.isBlank(domainWithoutLastPoint)) { return false; } if (!domainWithoutLastPoint.endsWith(ARPA_SUFFIX)) { return true; } domainWithoutLastPoint = StringUtils.lowerCase(domainWithoutLastPoint); if (isIpV4ArpaTldAndLabelIsValid(domainWithoutLastPoint) || isIpV6ArpaTldAndLabelIsValid(domainWithoutLastPoint)) { return true; } return false; } private  DomainUtil(); }
DomainUtil { public static boolean isArpaTldAndLabelIsValid(String domainName) { String domainWithoutLastPoint = deleteLastPoint(domainName); if (StringUtils.isBlank(domainWithoutLastPoint)) { return false; } if (!domainWithoutLastPoint.endsWith(ARPA_SUFFIX)) { return true; } domainWithoutLastPoint = StringUtils.lowerCase(domainWithoutLastPoint); if (isIpV4ArpaTldAndLabelIsValid(domainWithoutLastPoint) || isIpV6ArpaTldAndLabelIsValid(domainWithoutLastPoint)) { return true; } return false; } private  DomainUtil(); static boolean isArpaTldAndLabelIsValid(String domainName); static boolean validateDomainNameIsValidIdna(String domainName,
            boolean forSearch); static boolean validateSearchStringIsValidIdna(String searchString); static String deleteLastPoint(String paramStr); static String getLowerCaseByLabel(String str); static String safeGeneDomainPunyName(String domainName); static String geneDomainPunyName(String domainName); static String urlDecodeAndReplaceAsciiToLowercase(String str); static String replaceAsciiToLowercase(String str); static String urlDecode(String str); static String iso8859Decode(String str); static boolean isLdh(String domain); static boolean validateSearchLdnName(String searchString); }
DomainUtil { public static boolean isArpaTldAndLabelIsValid(String domainName) { String domainWithoutLastPoint = deleteLastPoint(domainName); if (StringUtils.isBlank(domainWithoutLastPoint)) { return false; } if (!domainWithoutLastPoint.endsWith(ARPA_SUFFIX)) { return true; } domainWithoutLastPoint = StringUtils.lowerCase(domainWithoutLastPoint); if (isIpV4ArpaTldAndLabelIsValid(domainWithoutLastPoint) || isIpV6ArpaTldAndLabelIsValid(domainWithoutLastPoint)) { return true; } return false; } private  DomainUtil(); static boolean isArpaTldAndLabelIsValid(String domainName); static boolean validateDomainNameIsValidIdna(String domainName,
            boolean forSearch); static boolean validateSearchStringIsValidIdna(String searchString); static String deleteLastPoint(String paramStr); static String getLowerCaseByLabel(String str); static String safeGeneDomainPunyName(String domainName); static String geneDomainPunyName(String domainName); static String urlDecodeAndReplaceAsciiToLowercase(String str); static String replaceAsciiToLowercase(String str); static String urlDecode(String str); static String iso8859Decode(String str); static boolean isLdh(String domain); static boolean validateSearchLdnName(String searchString); static final String XN_PREFIX; static final String ACE_PREFIX; static final int MAX_DOMAIN_LENGTH_WITHOUT_LAST_DOT; static final int MIN_DOMAIN_LENGTH_WITHOUT_LAST_DOT; static final String ARPA_SUFFIX; static final String IPV4_ARPA_SUFFIX; static final String IPV6_ARPA_SUFFIX; static final int MAX_ASCII_CODE; static final String BLANK_IN_DOMAIN; static final java.lang.String DISALLOWED_DELIMITERS; }