@ Nonnull public static String determineHostName ( @ Nonnull final String defaultValue ) { checkNotNull ( defaultValue , "Unable to use default value of null for hostname" ) ; if ( ! OPT_HOSTNAME . isPresent ( ) ) { try { return determineHostName ( ) ; // this will get and save it. } catch ( final UnknownHostException e ) { log . error ( "Unable to find hostname " + e . getMessage ( ) , e ) ; // exception to pick up in logsig } } return OPT_HOSTNAME . or ( defaultValue ) ; }
Same as determineHostName but will use default value instead of throwing UnknownHostException