* @throws TaskDescriptionException If the task is invalid.
*/
public static ITaskConfig validateAndPopulate(ITaskConfig config)
throws TaskDescriptionException {
TaskConfig builder = config.newBuilder();
if (!builder.isSetRequestedPorts()) {
builder.setRequestedPorts(ImmutableSet.<String>of());
}
maybeFillLinks(builder);
assertOwnerValidity(config.getOwner());
if (!isGoodIdentifier(config.getJobName())) {
throw new TaskDescriptionException(
"Job name contains illegal characters: " + config.getJobName());
}
if (!isGoodIdentifier(config.getEnvironment())) {
throw new TaskDescriptionException(
"Environment contains illegal characters: " + config.getEnvironment());
}
if (!builder.isSetExecutorConfig()) {
throw new TaskDescriptionException("Configuration may not be null");
}
// Maximize the usefulness of any thrown error message by checking required fields first.
for (RequiredFieldValidator<?> validator : REQUIRED_FIELDS_VALIDATORS) {