Skip to content

Commit

Permalink
RANGER-4664: GDS validation updated to handle empty resource
Browse files Browse the repository at this point in the history
Signed-off-by: Madhan Neethiraj <madhan@apache.org>
  • Loading branch information
suchnit authored and mneethiraj committed Jan 19, 2024
1 parent 30dd2b5 commit 255aabc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ public enum ValidationErrorCode {
GDS_DATASET_NAME_TOO_LONG(4129, "Invalid dataset name=[{0}]. Dataset name should not be longer than 512 characters"),
GDS_DATASHARE_NAME_TOO_LONG(4130, "Invalid datashare name=[{0}]. Datashare name should not be longer than 512 characters"),
GDS_PROJECT_NAME_TOO_LONG(4131, "Invalid project name=[{0}]. Project name should not be longer than 512 characters"),
GDS_VALIDATION_ERR_SHARED_RESOURCE_RESOURCE_NULL(4132, "Resource value in SharedResource [{0}] is null"),
;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,8 @@ public void validateCreate(RangerSharedResource resource) {

if (existing != null) {
result.addValidationFailure(new ValidationFailureDetails(ValidationErrorCode.GDS_VALIDATION_ERR_SHARED_RESOURCE_NAME_CONFLICT, "name", resource.getName(), dataShare.getName(), existing));
} else if (MapUtils.isEmpty(resource.getResource())) {
result.addValidationFailure(new ValidationFailureDetails(ValidationErrorCode.GDS_VALIDATION_ERR_SHARED_RESOURCE_RESOURCE_NULL, "resource", resource.getName()));
} else {
validateSharedResourceCreateAndUpdate(dataShare, result);

Expand Down Expand Up @@ -335,6 +337,8 @@ public void validateUpdate(RangerSharedResource resource, RangerSharedResource e

if (dataShare == null) {
result.addValidationFailure(new ValidationFailureDetails(ValidationErrorCode.GDS_VALIDATION_ERR_DATA_SHARE_ID_NOT_FOUND, "dataShareId", resource.getDataShareId()));
} else if (MapUtils.isEmpty(resource.getResource())) {
result.addValidationFailure(new ValidationFailureDetails(ValidationErrorCode.GDS_VALIDATION_ERR_SHARED_RESOURCE_RESOURCE_NULL, "resource", resource.getName()));
} else {
validateSharedResourceCreateAndUpdate(dataShare, result);

Expand Down

0 comments on commit 255aabc

Please sign in to comment.