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