@ Deprecated public static boolean verifyHostName ( String hostname , String pattern ) { String canonicalHostname ; if ( hostname . startsWith ( "[" ) && hostname . endsWith ( "]" ) ) { // IPv6 address like [2001:db8:0:1:1:1:1:1] canonicalHostname = hostname . substring ( 1 , hostname . length ( ) - 1 ) ; } else { // This converts unicode domain name to ASCII try { canonicalHostname = IDN . toASCII ( hostname ) ; } catch ( IllegalArgumentException e ) { // e.g. hostname is invalid return false ; } } return PGjdbcHostnameVerifier . INSTANCE . verifyHostName ( canonicalHostname , pattern ) ; }
Verifies if given hostname matches pattern .