From 3009edf10172eec43009d4c694392d0e64c9c17c Mon Sep 17 00:00:00 2001 From: Brendan Le Ny Date: Fri, 21 Jun 2024 11:02:29 +0200 Subject: [PATCH] Remove pointless exception encapsulation --- .../java/sh/libre/scim/core/ScimClient.java | 42 +++++++------------ 1 file changed, 14 insertions(+), 28 deletions(-) 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); }