diff --git a/src/main/java/io/cryostat/reports/Reports.java b/src/main/java/io/cryostat/reports/Reports.java index 99c8b2681..d40cb895f 100644 --- a/src/main/java/io/cryostat/reports/Reports.java +++ b/src/main/java/io/cryostat/reports/Reports.java @@ -37,6 +37,7 @@ import jakarta.annotation.security.RolesAllowed; import jakarta.inject.Inject; import jakarta.inject.Named; +import jakarta.ws.rs.ClientErrorException; import jakarta.ws.rs.GET; import jakarta.ws.rs.NotFoundException; import jakarta.ws.rs.Path; @@ -85,9 +86,12 @@ public Response getV1(@RestPath String recordingName) { String filename = objectName.split("/")[1]; result.put(jvmId, filename); }); - if (result.size() != 1) { + if (result.size() == 0) { throw new NotFoundException(); } + if (result.size() > 1) { + throw new ClientErrorException(Response.Status.CONFLICT); + } var entry = result.entrySet().iterator().next(); return Response.status(RestResponse.Status.PERMANENT_REDIRECT) .location(