diff --git a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java index 8f5ce275a..450602096 100644 --- a/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java +++ b/httpclient5-cache/src/test/java/org/apache/hc/client5/http/impl/cache/ConsumableInputStream.java @@ -30,7 +30,7 @@ import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import org.apache.hc.client5.http.utils.Closer; +import org.apache.hc.core5.io.Closer; public class ConsumableInputStream extends InputStream { diff --git a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java index 6ae8af048..ffcd99901 100644 --- a/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java +++ b/httpclient5-osgi/src/main/java/org/apache/hc/client5/http/osgi/impl/HttpProxyConfigurationActivator.java @@ -37,7 +37,7 @@ import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.osgi.services.CachingHttpClientBuilderFactory; import org.apache.hc.client5.http.osgi.services.HttpClientBuilderFactory; import org.apache.hc.client5.http.osgi.services.ProxyConfiguration; -import org.apache.hc.client5.http.utils.Closer; +import org.apache.hc.core5.io.Closer; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; diff --git a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java index ed0938b23..8c9dabc9e 100644 --- a/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java +++ b/httpclient5-testing/src/test/java/org/apache/hc/client5/testing/sync/LocalServerTestBase.java @@ -33,7 +33,6 @@ import org.apache.hc.client5.http.config.RequestConfig; import org.apache.hc.client5.http.impl.classic.CloseableHttpClient; import org.apache.hc.client5.http.impl.classic.HttpClientBuilder; import org.apache.hc.client5.http.impl.io.PoolingHttpClientConnectionManager; -import org.apache.hc.client5.http.utils.Closer; import org.apache.hc.client5.testing.SSLTestContexts; import org.apache.hc.client5.testing.classic.EchoHandler; import org.apache.hc.client5.testing.classic.RandomHandler; @@ -44,6 +43,7 @@ import org.apache.hc.core5.http.io.HttpServerRequestHandler; import org.apache.hc.core5.http.io.SocketConfig; import org.apache.hc.core5.http.protocol.HttpProcessor; import org.apache.hc.core5.io.CloseMode; +import org.apache.hc.core5.io.Closer; import org.apache.hc.core5.testing.classic.ClassicTestServer; import org.apache.hc.core5.util.Timeout; import org.junit.Rule; diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java index c07c4d2dc..3f473a3ac 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/impl/async/MinimalHttpAsyncClient.java @@ -46,7 +46,6 @@ import org.apache.hc.client5.http.nio.AsyncClientConnectionManager; import org.apache.hc.client5.http.nio.AsyncConnectionEndpoint; import org.apache.hc.client5.http.protocol.HttpClientContext; import org.apache.hc.client5.http.routing.RoutingSupport; -import org.apache.hc.client5.http.utils.Closer; import org.apache.hc.core5.concurrent.BasicFuture; import org.apache.hc.core5.concurrent.Cancellable; import org.apache.hc.core5.concurrent.ComplexCancellable; @@ -71,6 +70,7 @@ import org.apache.hc.core5.http.nio.command.ShutdownCommand; import org.apache.hc.core5.http.protocol.HttpContext; import org.apache.hc.core5.http2.HttpVersionPolicy; import org.apache.hc.core5.io.CloseMode; +import org.apache.hc.core5.io.Closer; import org.apache.hc.core5.reactor.Command; import org.apache.hc.core5.reactor.DefaultConnectingIOReactor; import org.apache.hc.core5.reactor.IOEventHandlerFactory; diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java index aeceaa462..2da55628c 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/socket/PlainConnectionSocketFactory.java @@ -31,11 +31,11 @@ import java.io.IOException; import java.net.InetSocketAddress; import java.net.Socket; -import org.apache.hc.client5.http.utils.Closer; import org.apache.hc.core5.annotation.Contract; import org.apache.hc.core5.annotation.ThreadingBehavior; import org.apache.hc.core5.http.HttpHost; import org.apache.hc.core5.http.protocol.HttpContext; +import org.apache.hc.core5.io.Closer; import org.apache.hc.core5.util.TimeValue; /** diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java index 586d4b270..cf88c8522 100644 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java +++ b/httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java @@ -49,11 +49,11 @@ import javax.security.auth.x500.X500Principal; import org.apache.hc.client5.http.psl.PublicSuffixMatcherLoader; import org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory; -import org.apache.hc.client5.http.utils.Closer; import org.apache.hc.core5.annotation.Contract; import org.apache.hc.core5.annotation.ThreadingBehavior; import org.apache.hc.core5.http.HttpHost; import org.apache.hc.core5.http.protocol.HttpContext; +import org.apache.hc.core5.io.Closer; import org.apache.hc.core5.ssl.SSLContexts; import org.apache.hc.core5.ssl.SSLInitializationException; import org.apache.hc.core5.util.Args; diff --git a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/Closer.java b/httpclient5/src/main/java/org/apache/hc/client5/http/utils/Closer.java deleted file mode 100644 index 3254e3ec9..000000000 --- a/httpclient5/src/main/java/org/apache/hc/client5/http/utils/Closer.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ==================================================================== - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * ==================================================================== - * - * This software consists of voluntary contributions made by many - * individuals on behalf of the Apache Software Foundation. For more - * information on the Apache Software Foundation, please see - * . - * - */ - -package org.apache.hc.client5.http.utils; - -import java.io.Closeable; -import java.io.IOException; - -/** - * Closes resources. TODO: Use the HttpCore version when the next beta comes out. - */ -public class Closer { - - /** - * Closes the given closeable quietly even in the event of an exception. - * - * @param closeable - * what to close. - */ - public static void closeQuietly(final Closeable closeable) { - if (closeable != null) { - try { - closeable.close(); - } catch (final IOException e) { - // Quietly ignore - } - } - } -}