code: public static void checkDuration(final String duration, final String name) throws IllegalArgumentException {
      if (!duration.matches("(\\d+[wdmhs])+|inf")) {
        throw new IllegalArgumentException("Invalid InfluxDB duration: " + duration
           + " for " + name);
      }
    }
docs: Enforces that the duration is a valid influxDB duration.
  @param duration the duration to test
  @param name variable name for reporting
  @throws IllegalArgumentException if the given duration is not valid.