static void ensureHostnamePatternMatchesDefaultHostname ( String hostnamePattern , String defaultHostname ) { if ( "*" . equals ( hostnamePattern ) ) { return ; } // Pretty convoluted way to validate but it's done only once and // we don't need to duplicate the pattern matching logic. final DomainNameMapping < Boolean > mapping = new DomainNameMappingBuilder <> ( Boolean . FALSE ) . add ( hostnamePattern , Boolean . TRUE ) . build ( ) ; if ( ! mapping . map ( defaultHostname ) ) { throw new IllegalArgumentException ( "defaultHostname: " + defaultHostname + " (must be matched by hostnamePattern: " + hostnamePattern + ' ' ) ; } }
Ensure that hostnamePattern matches defaultHostname .