mirror of https://github.com/apache/nifi.git
NIFI-7691: Validate request object to be not null.
This commit is contained in:
parent
2de4962ff1
commit
6a497aa8c3
|
@ -634,6 +634,10 @@ public class FlowResource extends ApplicationResource {
|
|||
required = true
|
||||
) final ScheduleComponentsEntity requestScheduleComponentsEntity) {
|
||||
|
||||
if (requestScheduleComponentsEntity == null) {
|
||||
throw new IllegalArgumentException("Schedule Component must be specified.");
|
||||
}
|
||||
|
||||
// ensure the same id is being used
|
||||
if (!id.equals(requestScheduleComponentsEntity.getId())) {
|
||||
throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does "
|
||||
|
@ -821,6 +825,10 @@ public class FlowResource extends ApplicationResource {
|
|||
@ApiParam(value = "The request to schedule or unschedule. If the comopnents in the request are not specified, all authorized components will be considered.", required = true)
|
||||
final ActivateControllerServicesEntity requestEntity) {
|
||||
|
||||
if (requestEntity == null) {
|
||||
throw new IllegalArgumentException("Controller service must be specified.");
|
||||
}
|
||||
|
||||
// ensure the same id is being used
|
||||
if (!id.equals(requestEntity.getId())) {
|
||||
throw new IllegalArgumentException(String.format("The process group id (%s) in the request body does "
|
||||
|
|
|
@ -328,6 +328,10 @@ public class ParameterContextResource extends ApplicationResource {
|
|||
@PathParam("contextId") final String contextId,
|
||||
@ApiParam(value = "The updated version of the parameter context.", required = true) final ParameterContextEntity requestEntity) {
|
||||
|
||||
if (requestEntity == null) {
|
||||
throw new IllegalArgumentException("Parameter Context must be specified.");
|
||||
}
|
||||
|
||||
// Verify the request
|
||||
final RevisionDTO revisionDto = requestEntity.getRevision();
|
||||
if (revisionDto == null) {
|
||||
|
@ -619,6 +623,10 @@ public class ParameterContextResource extends ApplicationResource {
|
|||
@PathParam("contextId") final String contextId,
|
||||
@ApiParam(value = "The validation request", required=true) final ParameterContextValidationRequestEntity requestEntity) {
|
||||
|
||||
if (requestEntity == null) {
|
||||
throw new IllegalArgumentException("Parameter Context must be specified.");
|
||||
}
|
||||
|
||||
final ParameterContextValidationRequestDTO requestDto = requestEntity.getRequest();
|
||||
if (requestDto == null) {
|
||||
throw new IllegalArgumentException("Parameter Context must be specified");
|
||||
|
|
|
@ -3531,7 +3531,7 @@ public class ProcessGroupResource extends FlowUpdateResource<ProcessGroupImportE
|
|||
required = true
|
||||
) final CreateTemplateRequestEntity requestCreateTemplateRequestEntity) {
|
||||
|
||||
if (requestCreateTemplateRequestEntity.getSnippetId() == null) {
|
||||
if (requestCreateTemplateRequestEntity == null || requestCreateTemplateRequestEntity.getSnippetId() == null) {
|
||||
throw new IllegalArgumentException("The snippet identifier must be specified.");
|
||||
}
|
||||
|
||||
|
|
|
@ -468,6 +468,10 @@ public class VersionsResource extends FlowUpdateResource<VersionControlInformati
|
|||
@ApiParam("The process group id.") @PathParam("id") final String groupId,
|
||||
@ApiParam(value = "The versioned flow details.", required = true) final StartVersionControlRequestEntity requestEntity) {
|
||||
|
||||
if (requestEntity == null) {
|
||||
throw new IllegalArgumentException("Version control request must be specified.");
|
||||
}
|
||||
|
||||
// Verify the request
|
||||
final RevisionDTO revisionDto = requestEntity.getProcessGroupRevision();
|
||||
if (revisionDto == null) {
|
||||
|
@ -1004,6 +1008,10 @@ public class VersionsResource extends FlowUpdateResource<VersionControlInformati
|
|||
@ApiParam("The process group id.") @PathParam("id") final String groupId,
|
||||
@ApiParam(value = "The controller service configuration details.", required = true) final VersionControlInformationEntity requestEntity) {
|
||||
|
||||
if (requestEntity == null) {
|
||||
throw new IllegalArgumentException("Version control information must be specified.");
|
||||
}
|
||||
|
||||
// validate version control info
|
||||
final VersionControlInformationDTO requestVersionControlInfoDto = requestEntity.getVersionControlInformation();
|
||||
if (requestVersionControlInfoDto == null) {
|
||||
|
@ -1068,6 +1076,10 @@ public class VersionsResource extends FlowUpdateResource<VersionControlInformati
|
|||
public Response initiateRevertFlowVersion(@ApiParam("The process group id.") @PathParam("id") final String groupId,
|
||||
@ApiParam(value = "The controller service configuration details.", required = true) final VersionControlInformationEntity requestEntity) {
|
||||
|
||||
if (requestEntity == null) {
|
||||
throw new IllegalArgumentException("Version control information must be specified.");
|
||||
}
|
||||
|
||||
// Verify the request
|
||||
final RevisionDTO revisionDto = requestEntity.getProcessGroupRevision();
|
||||
if (revisionDto == null) {
|
||||
|
|
Loading…
Reference in New Issue