private static String convertToQuotedString ( String s ) { if ( s == null || s . isEmpty ( ) ) { return null ; } // If already quoted, return as-is if ( s . charAt ( 0 ) == ' ' && s . charAt ( s . length ( ) - 1 ) == ' ' ) { return s ; } return ' ' + s + ' ' ; }
Encloses the incoming string inside double quotes if it isn t already quoted .