public static final boolean parseBoolean ( String value , String errorMsgOnParseFailure ) { // avoiding Boolean.valueOf() to have more checks: makes it easy to spot wrong type in cfg. if ( value == null ) { throw new SearchException ( errorMsgOnParseFailure ) ; } else if ( "false" . equalsIgnoreCase ( value . trim ( ) ) ) { return false ; } else if ( "true" . equalsIgnoreCase ( value . trim ( ) ) ) { return true ; } else { throw new SearchException ( errorMsgOnParseFailure ) ; } }
Parses a string to recognize exactly either true or false .