Skip to content

Commit

Permalink
Make some fields in manifest file as mandatory
Browse files Browse the repository at this point in the history
Signed-off-by: Heemin Kim <[email protected]>
  • Loading branch information
heemin32 committed May 4, 2023
1 parent 281dc5c commit fe4ef5c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ private void validateManifestFile(final URL url, final ActionRequestValidationEx
manifest = DatasourceManifest.Builder.build(url);
} catch (Exception e) {
log.info("Error occurred while reading a file from {}", url, e);
errors.addValidationError(String.format(Locale.ROOT, "Error occurred while reading a file from %s", url));
errors.addValidationError(String.format(Locale.ROOT, "Error occurred while reading a file from %s: %s", url, e.getMessage()));
return;
}

Expand All @@ -188,7 +188,9 @@ private void validateManifestFile(final URL url, final ActionRequestValidationEx
return;
}

if (updateInterval.days() >= manifest.getValidForInDays()) {

if (manifest.getValidForInDays() != null &&
updateInterval.days() >= manifest.getValidForInDays()) {
errors.addValidationError(
String.format(
Locale.ROOT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ public class DatasourceManifest {
}
);
static {
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), URL_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), DB_NAME_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), SHA256_HASH_FIELD);
PARSER.declareString(ConstructingObjectParser.constructorArg(), URL_FIELD);
PARSER.declareString(ConstructingObjectParser.constructorArg(), DB_NAME_FIELD);
PARSER.declareString(ConstructingObjectParser.constructorArg(), SHA256_HASH_FIELD);
PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), VALID_FOR_IN_DAYS_FIELD);
PARSER.declareLong(ConstructingObjectParser.optionalConstructorArg(), UPDATED_AT_FIELD);
PARSER.declareString(ConstructingObjectParser.optionalConstructorArg(), PROVIDER_FIELD);
PARSER.declareLong(ConstructingObjectParser.constructorArg(), UPDATED_AT_FIELD);
PARSER.declareString(ConstructingObjectParser.constructorArg(), PROVIDER_FIELD);
}

/**
Expand Down

0 comments on commit fe4ef5c

Please sign in to comment.