code: 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;
      }
docs: Checks that the given value's normalized length is in the allowed range.
  
  @param name the name of the property being checked, for error reporting.
  @param value the value.
  @param maxLen the maximum length allowed.
  @return the normalized value.
  @throws IllegalArgumentException if the normalized value is null,
  zero-length, or exceeds the maximum length specified.