public static String validate ( String name , String value , int maxLen ) throws IllegalArgumentException { String normVal = normalize ( value ) ; if ( normVal == null ) { throw new IllegalArgumentException ( "A value must be specified for" + " '" + name + "'" ) ; } else if ( normVal . length ( ) > maxLen ) { throw new IllegalArgumentException ( "The value specified for" + " '" + name + "' was too long. It must not exceed" + " " + maxLen + " characters." ) ; } return normVal ; }
Checks that the given value s normalized length is in the allowed range .