Validates the timespan
@throws IllegalArgumentException if one or more parameters were invalid
507907
public void validate() {
    if (start == null || start.isEmpty()) {
      throw new IllegalArgumentException("missing or empty start");
    }
    DateTime.parseDateTimeString(start, timezone);
    
    if (end != null && !end.isEmpty()) {
      DateTime.parseDateTimeString(end, timezone);
    }
    
    if (downsampler != null) {
      downsampler.validate();
    }
    
    if (aggregator == null || aggregator.isEmpty()) {
      throw new IllegalArgumentException("Missing or empty aggregator");
    }
    
    try {
      Aggregators.get(aggregator.toLowerCase());
    } catch (final NoSuchElementException e) {
      throw new IllegalArgumentException("Invalid aggregator");
    }
  }
918506
protected function isEndTimeValid()
    {
        $this->valid_range_end->setYear(self::$date_year);
        $this->valid_range_end->setMonth(self::$date_month);
        $this->valid_range_end->setDay(self::$date_day);
        $this->valid_range_end->setTZById('UTC');

        return SwatDate::compare($this->value, $this->valid_range_end, true) <=
            0;
    }
1030310
public function validate()
    {
        if (time() > $this->getExpiration()) {
            throw new exceptions\TokenExpiredException('Token is expired.');
        }
        if ($this->getHash() != $this->generateHash()) {
            throw new exceptions\InvalidHashException('Invalid token hash.');
        }
    }
831743
boolean validateSettings() throws IllegalArgumentException {
        // Validate values which do not require user input first to avoid unnecesary
        // work on the user part.

        // dates
        if (startDate != null && stopDate != null) {
            if (startDate.after(stopDate)) {
                // stop date is before the start date.
                throw new IllegalArgumentException(getLocalizedString("CWTRA0026E"));
            }
        }

        // Validate levels if specified.
        if (maxLevel != null && minLevel != null) {
            // We have both a max and min level. Check that the min level is
            // equal to or less than the max level
            if (minLevel.intValue() > maxLevel.intValue()) {
                // Min is greater than Max level. Report error
                throw new IllegalArgumentException(getLocalizedString("CWTRA0027E"));
            }
        }

        // Required options
        if (binaryRepositoryDir == null) {
            File[] servers = listRepositoryChoices();
            File repositoryDirFile = null;
            if (servers.length > 1) {
                System.out.println(getLocalizedString("LVM_SelectServerPrompt"));
                int i = 0;
                for (File s : servers) {
                    i++;
                    System.out.println(i + ") " + getLogDirName(s));
                }
                String serverNum = null;
                int serverNumInt = 0;
                BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
                while (repositoryDirFile == null) {
                    System.out.print("[1-" + i + "]: ");
                    try {
                        serverNum = input.readLine();
                        serverNumInt = Integer.parseInt(serverNum);
                        if ((serverNumInt >= 1) && (serverNumInt <= i)) {
                            repositoryDirFile = servers[serverNumInt - 1];
                        }
                    } catch (NumberFormatException e) {
                        // Line does not contain a number.
                    } catch (IOException e) {
                        // Assume user just want to exit.
                        return true;
                    }
                } // end while loop
            } else if (servers.length == 1) {
                repositoryDirFile = servers[0];
            }

            if (repositoryDirFile != null) {
                // appears we have a repositoryDir
                try {
                    setBinaryRepositoryDir(repositoryDirFile.getCanonicalPath());
                    System.out.println(getLocalizedParmString("CWTRA0030I", new Object[] { binaryRepositoryDir }));
                } catch (IOException e) {
                    // TODO We don't want to print stack traces so what should we be doing here?
                    //e.printStackTrace();
                }
            }

            if (binaryRepositoryDir == null) {
                throw new IllegalArgumentException(getLocalizedString("CWTRA0024E"));
            }
        }

        return false;

    }
861617
protected static void validateParamsPresence(Map params, String... keys) {
        for (String name : keys) {
            if (!params.containsKey(name)) {
                throw new IllegalArgumentException("parameter: '" + name + "' is missing");
            }
        }
    }
893627
private void validate() {

        if (host.isEmpty()) {
            throw new IllegalArgumentException("host cannot be null");
        }
        if (catalog == null) {
            throw new IllegalArgumentException("database cannot be null");
        }
        if (table == null) {
            throw new IllegalArgumentException("collection cannot be null");
        }

        concantHostPort();
    }
1003496
public void validate() {
    if (StringUtils.isEmpty(name) || StringUtils.isEmpty(group)) {
      throw new IllegalArgumentException("Package name or group not set.");
    }
    if (filters.isEmpty()) {
      throw new IllegalArgumentException("No package filter defined / no package root path set.");
    }
    if (created == null) {
      throw new IllegalArgumentException("Package creation date not set.");
    }
  }
79882
public function validate() {

		if ($this->getEndAction() === null) {
			throw new ValidationException("'endAction' can't be null", 'endAction', $this);
		}
		if ($this->getPlannedEndDate() === null) {
			throw new ValidationException("'plannedEndDate' can't be null", 'plannedEndDate', $this);
		}
		if ($this->getSubscription() === null) {
			throw new ValidationException("'subscription' can't be null", 'subscription', $this);
		}
	}
518352
protected function validateTimestamp($value, ValidationField $field) {
        if (is_numeric($value) && $value > 0) {
            $result = (int)$value;
        } elseif (is_string($value) && $ts = strtotime($value)) {
            $result = $ts;
        } else {
            $field->addTypeError($value, 'timestamp');
            $result = Invalid::value();
        }
        return $result;
    }
1068224
public void checkInvalidParameters() {
    	for(String key: map.keySet()) {
    		boolean wasRequested = requestedKeys != null && requestedKeys.contains(key);
    		if(!wasRequested) throw new IllegalArgumentException("Unknown parameter " + key);
    		
    	}
    }
835785
def _ValidateTimeRange(timerange):
  """"""
  if len(timerange) != 2:
    raise ValueError("Timerange should be a sequence with 2 items.")

  (start, end) = timerange
  precondition.AssertOptionalType(start, rdfvalue.RDFDatetime)
  precondition.AssertOptionalType(end, rdfvalue.RDFDatetime)
51612
protected function validate()
    {
        if (!in_array($this->operation, self::$allowedOperations, true)) {
            throw new InvalidArgumentException('Unsupported condition operation');
        }

        if (!is_array($this->value) && $this->isArrayOperation()) {
            throw new InvalidArgumentException('Value is not of type array');
        }

        if (is_array($this->value) && $this->isRangeOperation() && count($this->value) < 2) {
            throw new InvalidArgumentException('Wrong number of values for range');
        }
    }
155901
private function validate() {
        $errors = [];

        foreach ($this->eventDetails as $key => $value) {
            if (strpos($key, 'tp_') !== false) {
                $errors[$key] = 'Property names cannot start with the reserved prefix \'tp_\'';
            }
            if (strpos($key, '.') !== false) {
                $errors[$key] = 'Property names cannot contain a period (.)';
            }
            if (strcmp($key, '_id') == 0) {
                $errors[$key] = 'Top level properties cannot be named \'_id\'';
            }
        }

        if (!empty($errors)) {
            throw new InvalidPropertyNameException($errors);
        }
    }
604957
protected void validateSTG(){
		if(this.stg==null){
			throw new IllegalArgumentException("stg is null");
		}

		STGroupValidator stgv = new STGroupValidator(this.stg, MessageRenderer.STG_CHUNKS);
		if(stgv.getValidationErrors().hasErrors()){
			throw new IllegalArgumentException(stgv.getValidationErrors().render());
		}
	}
1364298
public void validate() {
    if (policy == null) {
      if (value == 0) {
        policy = FillPolicy.ZERO;
      } else if (Double.isNaN(value)) {
        policy = FillPolicy.NOT_A_NUMBER;
      } else {
        policy = FillPolicy.SCALAR;
      }
    } else {
      switch (policy) {
      case NONE:
      case NOT_A_NUMBER:
        if (value != 0 && !Double.isNaN(value)) {
          throw new IllegalArgumentException(
              "The value for NONE and NAN must be NaN");
        }
        value = Double.NaN;
        break;
      case ZERO:
        if (value != 0) {
          throw new IllegalArgumentException("The value for ZERO must be 0");
        }
        value = 0;
        break;
      case NULL:
        if (value != 0 && !Double.isNaN(value)) {
          throw new IllegalArgumentException("The value for NULL must be 0");
        }
        value = Double.NaN;
        break;
      case SCALAR: // it CAN be zero
        break;
      }
    }
  }
1224418
private function validateAnnotations()
    {
        //Count annotations in the annotation namespace, ignore annotations not in our namespace
        $count = 0;
        foreach($this->annotations as $a)
        {
            //If you find the namespace in the class name, add to count
            if(strrpos(get_class($a), self::ANNOTATION_NAMESPACE) !== false)
            {
                $count++;
            }
        }

        switch($count)
        {
            //0 annotations, just ignore
            case 0:

                return;

            //1 Annotation, it can't be index.
            case 1:

                if($this->getAnnotationIndex(self::INDEX) < 0)
                {
                    //It's not index, return.
                    return;
                }

                throw new Exception("@Index cannot be the only annotation on {$this->name} in {$this->property->getDeclaringClass()->getName()}.");

            //2 Annotations, they have to be index and property.
            case 2:

                if( ($this->getAnnotationIndex(self::PROPERTY) >= 0) && ($this->getAnnotationIndex(self::INDEX) >= 0))
                {
                    //They are index and property, return
                    return;
                }

                break;
        }

        //It didn't fall into any of the categories, must be invalid
        throw new Exception("Invalid annotation combination on {$this->name} in {$this->property->getDeclaringClass()->getName()}.");
    }
799480
@Override
    public void validateTerms(Set<ValueIndexTerm> queryTerms) throws IllegalArgumentException {
        checkNotNullAndNotEmpty(queryTerms);

        checkInvalidAndRequiredTerms(queryTerms,
                                     NAME,
                                     new String[]{
                                             ResourceType.JAVA.toString(),
                                             null, null // not required
                                     },
                                     (t) -> (t.getTerm().equals(ResourceType.JAVA.toString())),
                                     (t) -> (t instanceof ValueModuleNameIndexTerm),
                                     (t) -> (t instanceof ValueBranchNameIndexTerm)
        );
    }