diff --git a/src/main/java/sh/libre/scim/core/ScimClient.java b/src/main/java/sh/libre/scim/core/ScimClient.java index 18460562c6..ac635bcd14 100644 --- a/src/main/java/sh/libre/scim/core/ScimClient.java +++ b/src/main/java/sh/libre/scim/core/ScimClient.java @@ -70,16 +70,11 @@ public class ScimClient implements AutoCloseable { ); } Retry retry = retryRegistry.retry("create-%s".formatted(id.asString())); - ServerResponse response = retry.executeSupplier(() -> { - try { - return scimRequestBuilder - .create(getResourceClass(), getScimEndpoint()) - .setResource(scimForCreation) - .sendRequest(); - } catch (ResponseException e) { - throw new RuntimeException(e); - } - }); + ServerResponse response = retry.executeSupplier(() -> scimRequestBuilder + .create(getResourceClass(), getScimEndpoint()) + .setResource(scimForCreation) + .sendRequest() + ); checkResponseIsSuccess(response); S resource = response.getResource(); return resource.getId() @@ -104,29 +99,20 @@ public class ScimClient implements AutoCloseable { public void replace(EntityOnRemoteScimId externalId, ResourceNode scimForReplace) { Retry retry = retryRegistry.retry("replace-%s".formatted(externalId.asString())); - ServerResponse response = retry.executeSupplier(() -> { - try { - return scimRequestBuilder - .update(getResourceClass(), getScimEndpoint(), externalId.asString()) - .setResource(scimForReplace) - .sendRequest(); - } catch (ResponseException e) { - throw new RuntimeException(e); - } - }); + ServerResponse response = retry.executeSupplier(() -> scimRequestBuilder + .update(getResourceClass(), getScimEndpoint(), externalId.asString()) + .setResource(scimForReplace) + .sendRequest() + ); checkResponseIsSuccess(response); } public void delete(EntityOnRemoteScimId externalId) { Retry retry = retryRegistry.retry("delete-%s".formatted(externalId.asString())); - ServerResponse response = retry.executeSupplier(() -> { - try { - return scimRequestBuilder.delete(getResourceClass(), getScimEndpoint(), externalId.asString()) - .sendRequest(); - } catch (ResponseException e) { - throw new RuntimeException(e); - } - }); + ServerResponse response = retry.executeSupplier(() -> scimRequestBuilder + .delete(getResourceClass(), getScimEndpoint(), externalId.asString()) + .sendRequest() + ); checkResponseIsSuccess(response); }