Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ public Response retrieveAnalysis(@Parameter(description = "The UUID of the proje
public Response updateAnalysis(AnalysisRequest request) {
final Validator validator = getValidator();
failOnValidationError(
validator.validateProperty(request, "project"),
validator.validateProperty(request, "component"),
validator.validateProperty(request, "vulnerability"),
validator.validateProperty(request, "analysisState"),
Expand All @@ -158,13 +157,16 @@ public Response updateAnalysis(AnalysisRequest request) {
);
try (QueryManager qm = new QueryManager()) {
final Project project = qm.getObjectByUuid(Project.class, request.getProject());
if (project == null) {
return Response.status(Response.Status.NOT_FOUND).entity("The project could not be found.").build();
}

final Component component = qm.getObjectByUuid(Component.class, request.getComponent());
if (component == null) {
return Response.status(Response.Status.NOT_FOUND).entity("The component could not be found.").build();
}

if (project != null && component.getProject().getId() != project.getId()){
return Response.status(Response.Status.CONFLICT).entity("The component has a different project than the one specified via the project param.").build();
}

final Vulnerability vulnerability = qm.getObjectByUuid(Vulnerability.class, request.getVulnerability());
if (vulnerability == null) {
return Response.status(Response.Status.NOT_FOUND).entity("The vulnerability could not be found.").build();
Expand Down