Skip to content

Commit

Permalink
CIRC-2111 Remove redundant UUID parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderkurash committed Jun 20, 2024
1 parent aaa2759 commit 3a87757
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ void get(RoutingContext routingContext) {

ofAsync(routingContext.request().getParam("id"))
.thenApply(refuseWhenIdIsInvalid())
.thenApply(r -> r.map(providedId -> UUID.fromString(providedId).toString()))
.thenCompose(r -> r.after(circulationSettingsRepository::getById))
.thenApply(r -> r.map(CirculationSetting::getRepresentation))
.thenApply(r -> r.map(JsonHttpResponse::ok))
Expand All @@ -91,7 +90,6 @@ void delete(RoutingContext routingContext) {

ofAsync(routingContext.request().getParam("id"))
.thenApply(refuseWhenIdIsInvalid())
.thenApply(r -> r.map(providedId -> UUID.fromString(providedId).toString()))
.thenCompose(r -> r.after(clients.circulationSettingsStorageClient()::delete))
.thenApply(r -> r.map(toFixedValue(NoContentResponse::noContent)))
.thenAccept(context::writeResultToHttpResponse);
Expand Down Expand Up @@ -146,7 +144,7 @@ private boolean uuidIsValid(String providedId) {
try {
return providedId != null && providedId.equals(UUID.fromString(providedId).toString());
} catch(IllegalArgumentException e) {
log.debug("refuseWhenIdIsInvalid:: Invalid UUID");
log.debug("uuidIsValid:: Invalid UUID");
return false;
}
}
Expand Down

0 comments on commit 3a87757

Please sign in to comment.