@Test public void test_checkIfValidALabelDomain() { assertTrue(IdnaUtil.checkIfValidALabelDomain("中国")); assertTrue(IdnaUtil.checkIfValidALabelDomain("xn--fiqs8s")); assertTrue(IdnaUtil.checkIfValidALabelDomain("xn--fiqs8s.cn")); assertTrue(IdnaUtil.checkIfValidALabelDomain("xn--fiqs8s.中国")); assertTrue(IdnaUtil.checkIfValidALabelDomain("123")); assertTrue(IdnaUtil.checkIfValidALabelDomain("123.xn--fiqs8s")); assertTrue(IdnaUtil.checkIfValidALabelDomain("中国.xn--fiqs8s")); assertFalse(IdnaUtil.checkIfValidALabelDomain("xn--123")); assertFalse(IdnaUtil.checkIfValidALabelDomain("123.xn--123")); assertFalse(IdnaUtil.checkIfValidALabelDomain("xn--123.cn")); assertFalse(IdnaUtil.checkIfValidALabelDomain("xn--123.中国")); assertFalse(IdnaUtil.checkIfValidALabelDomain("xn--123*")); assertFalse(IdnaUtil.checkIfValidALabelDomain("55--123")); }
public static boolean checkIfValidALabelDomain(String aLabelDomain) { if (StringUtils.isBlank(aLabelDomain)) { return false; } try { toUnicode(aLabelDomain); return true; } catch (XcodeException e) { LOGGER.warn("toUnicode failed :" + e); return false; } }
IdnaUtil { public static boolean checkIfValidALabelDomain(String aLabelDomain) { if (StringUtils.isBlank(aLabelDomain)) { return false; } try { toUnicode(aLabelDomain); return true; } catch (XcodeException e) { LOGGER.warn("toUnicode failed :" + e); return false; } } }
IdnaUtil { public static boolean checkIfValidALabelDomain(String aLabelDomain) { if (StringUtils.isBlank(aLabelDomain)) { return false; } try { toUnicode(aLabelDomain); return true; } catch (XcodeException e) { LOGGER.warn("toUnicode failed :" + e); return false; } } private  IdnaUtil(); }
IdnaUtil { public static boolean checkIfValidALabelDomain(String aLabelDomain) { if (StringUtils.isBlank(aLabelDomain)) { return false; } try { toUnicode(aLabelDomain); return true; } catch (XcodeException e) { LOGGER.warn("toUnicode failed :" + e); return false; } } private  IdnaUtil(); static boolean checkIfValidALabelDomain(String aLabelDomain); static boolean isValidIdn(String domain); }
IdnaUtil { public static boolean checkIfValidALabelDomain(String aLabelDomain) { if (StringUtils.isBlank(aLabelDomain)) { return false; } try { toUnicode(aLabelDomain); return true; } catch (XcodeException e) { LOGGER.warn("toUnicode failed :" + e); return false; } } private  IdnaUtil(); static boolean checkIfValidALabelDomain(String aLabelDomain); static boolean isValidIdn(String domain);  }