private static void validateMessageText ( String messageML ) throws InvalidInputException { if ( messageML == null ) { throw new InvalidInputException ( "Message input is NULL" ) ; } for ( char ch : messageML . toCharArray ( ) ) { if ( ch != ' ' && ch != ' ' && ch != ' ' && ( ch < ' ' ) ) { throw new InvalidInputException ( "Invalid control characters in message" ) ; } } }
Check the input message text for null value and restricted characters .