private String trimAndParenthesise(String str){
  String parenthesisedString=str;
  if (str != null) {
    str=str.trim();
    if (!str.startsWith(OPEN_PARENTHESIS)) {
      parenthesisedString=OPEN_PARENTHESIS + str + CLOSE_PARENTHESIS;
    }
  }
 else {
    parenthesisedString=OPEN_PARENTHESIS + CLOSE_PARENTHESIS;
  }
  return parenthesisedString;
}

private String trimAndParenthesise ( String str ) { String parenthesisedString = str ; if ( str != null ) { str = str . trim ( ) ; if ( ! str . startsWith ( OPEN_PARENTHESIS ) ) { parenthesisedString = OPEN_PARENTHESIS + str + CLOSE_PARENTHESIS ; } } else { parenthesisedString = OPEN_PARENTHESIS + CLOSE_PARENTHESIS ; } return parenthesisedString ; }
utility method to trim and put parenthessis in the expected ldap filter format for a string representing the ldap filter .
