private void verifyForFormat() {
    for (Token token : tokens) {
      if (token.type == TokenType.TIMEZONE) {
        throw new IllegalArgumentException(token.string.toUpperCase() + " not a valid format for "
            + "timestamp or date.");
      }
    }
  }
Make sure the generated list of tokens is valid for formatting datetime objects to strings.
common/src/java/org/apache/hadoop/hive/common/format/datetime/HiveSqlDateTimeFormatter.java