Skip to content
Snippets Groups Projects
Commit db3de0d9 authored by Brendan Le Ny's avatar Brendan Le Ny
Browse files

Use try with resource

parent 10ff5787
No related branches found
No related tags found
1 merge request!3Sonar refactoring
......@@ -28,7 +28,7 @@ import java.util.HashMap;
import java.util.Map;
public class ScimClient {
public class ScimClient implements AutoCloseable {
private static final Logger LOGGER = Logger.getLogger(ScimClient.class);
......@@ -299,6 +299,7 @@ public class ScimClient {
}
}
@Override
public void close() {
scimRequestBuilder.close();
}
......
......@@ -33,13 +33,10 @@ public class ScimDispatcher {
public void runOne(ComponentModel m, Consumer<ScimClient> f) {
LOGGER.infof("%s %s %s %s", m.getId(), m.getName(), m.getProviderId(), m.getProviderType());
ScimClient client = ScimClient.newScimClient(m, session);
try {
try (ScimClient client = ScimClient.newScimClient(m, session)) {
f.accept(client);
} catch (Exception e) {
LOGGER.error(e);
} finally {
client.close();
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment