Use 'uncheck'
@@ -31,7 +31,6 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import javax.net.ssl.HostnameVerifier;
import java.io.IOException;
-import java.io.UncheckedIOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.util.ArrayList;
@@ -40,6 +39,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Optional;
+import static com.yahoo.vespa.hosted.node.admin.task.util.file.IOExceptionUtil.uncheck;
import static java.util.Collections.singleton;
/**
@@ -174,11 +174,7 @@ public class ConfigServerApiImpl implements ConfigServerApi {
@Override
public void close() {
- try {
- client.close();
- } catch (IOException e) {
- throw new UncheckedIOException(e);
- }
+ uncheck(client::close);
}
private void setContentTypeToApplicationJson(HttpRequestBase request) {
