RTEditor/src/main/java/com/onegravity/rteditor/utils/validator/DomainValidator.java
private static final String toASCII(String line) throws IllegalArgumentException {
//        java.net.IDN.toASCII(line); // Java 1.6+
        // implementation for Java 1.4 and 1.5
        // effectively this is done by IDN.toASCII but we want to skip the entire call
        if (isOnlyASCII(line)) {
            return line;
        }
        Method m = IDNHolder.JAVA_NET_IDN_TO_ASCII;
        if (m == null) { // avoid NPE
            return line;
        }
        try {
            return (String) m.invoke(null, new String[]{line.toLowerCase(Locale.ENGLISH)});
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e); // Should not happen
        } catch (InvocationTargetException e) {
            Throwable t = e.getCause();
            if (t instanceof IllegalArgumentException) { // this is expected from toASCII method
                throw (IllegalArgumentException) t;
            }
            throw new RuntimeException(e); // Should not happen
        }
    }
private static final String toASCII(String line) throws IllegalArgumentException {
//        java.net.IDN.toASCII(line); // Java 1.6+
        // implementation for Java 1.4 and 1.5
        // effectively this is done by IDN.toASCII but we want to skip the entire call
        if (isOnlyASCII(line)) {
            return line;
        }
        Method m = IDNHolder.JAVA_NET_IDN_TO_ASCII;
        if (m == null) { // avoid NPE
            return line;
        }
        try {
            return (String) m.invoke(null, new String[]{line.toLowerCase(Locale.ENGLISH)});
        } catch (IllegalAccessException e) {
            throw new RuntimeException(e); // Should not happen
        } catch (InvocationTargetException e) {
            Throwable t = e.getCause();
            if (t instanceof IllegalArgumentException) { // this is expected from toASCII method
                throw (IllegalArgumentException) t;
            }
            throw new RuntimeException(e); // Should not happen
        }
    }
/*
Helper method to invoke java.net.IDN.toAscii(String).
Allows code to be compiled with Java 1.4 and 1.5
@throws IllegalArgumentException if the input string doesn't conform to RFC 3490 specification