You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hc.apache.org by ol...@apache.org on 2013/08/09 22:11:35 UTC
svn commit: r1512474 - in /httpcomponents/httpclient/trunk:
httpclient-osgi/pom.xml
httpclient/src/main/java/org/apache/http/client/utils/HttpClientUtils.java
Author: olegk
Date: Fri Aug 9 20:11:34 2013
New Revision: 1512474
URL: http://svn.apache.org/r1512474
Log:
Removed reference to o.a.http.impl.client package from o.a.http.client.utils; fixed OSGi import / export warnings
Modified:
httpcomponents/httpclient/trunk/httpclient-osgi/pom.xml
httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/HttpClientUtils.java
Modified: httpcomponents/httpclient/trunk/httpclient-osgi/pom.xml
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient-osgi/pom.xml?rev=1512474&r1=1512473&r2=1512474&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient-osgi/pom.xml (original)
+++ httpcomponents/httpclient/trunk/httpclient-osgi/pom.xml Fri Aug 9 20:11:34 2013
@@ -121,6 +121,7 @@
org.apache.http.impl.auth.*;version=${project.version},
org.apache.http.impl.cookie.*;version=${project.version},
org.apache.http.impl.conn.*;version=${project.version},
+ org.apache.http.impl.execchain.*;version=${project.version}
org.apache.http.impl.client.*;version=${project.version}
org.apache.http.osgi.services;version=${project.version}
</_exportcontents>
@@ -136,6 +137,7 @@
org.osgi.service.cm,
org.apache.commons.logging;version=${commons-logging.version},
org.apache.http;version=${httpcore.version},
+ org.apache.http.config;version=${httpcore.version},
org.apache.http.concurrent;version=${httpcore.version},
org.apache.http.entity;version=${httpcore.version},
org.apache.http.io;version=${httpcore.version},
Modified: httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/HttpClientUtils.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/HttpClientUtils.java?rev=1512474&r1=1512473&r2=1512474&view=diff
==============================================================================
--- httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/HttpClientUtils.java (original)
+++ httpcomponents/httpclient/trunk/httpclient/src/main/java/org/apache/http/client/utils/HttpClientUtils.java Fri Aug 9 20:11:34 2013
@@ -26,13 +26,13 @@
*/
package org.apache.http.client.utils;
+import java.io.Closeable;
import java.io.IOException;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.CloseableHttpResponse;
-import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.util.EntityUtils;
/**
@@ -109,7 +109,7 @@ public class HttpClientUtils {
} finally {
response.close();
}
- } catch (final IOException ex) {
+ } catch (final IOException ignore) {
}
}
}
@@ -121,9 +121,9 @@ public class HttpClientUtils {
* Example Code:
*
* <pre>
- * HttpClient httpClient = null;
+ * HttpClient httpClient = HttpClients.createDefault();
* try {
- * httpClient = new DefaultHttpClient(...);
+ * httpClient.execute(request);
* } catch (Exception e) {
* // error handling
* } finally {
@@ -134,42 +134,14 @@ public class HttpClientUtils {
* @param httpClient
* the HttpClient to close, may be null or already closed.
* @since 4.2
- *
- * @deprecated (4.3) do not use.
*/
- @Deprecated
public static void closeQuietly(final HttpClient httpClient) {
if (httpClient != null) {
- httpClient.getConnectionManager().shutdown();
- }
- }
-
- /**
- * Unconditionally close a httpClient. Shuts down the underlying connection
- * manager and releases the resources.
- * <p>
- * Example Code:
- *
- * <pre>
- * CloseableHttpClient httpClient = HttpClients.createDefault();
- * try {
- * ...
- * } catch (Exception e) {
- * // error handling
- * } finally {
- * HttpClientUtils.closeQuietly(httpClient);
- * }
- * </pre>
- *
- * @param httpClient
- * the HttpClient to close, may be null or already closed.
- * @since 4.3
- */
- public static void closeQuietly(final CloseableHttpClient httpClient) {
- if (httpClient != null) {
- try {
- httpClient.close();
- } catch (final IOException ex) {
+ if (httpClient instanceof Closeable) {
+ try {
+ ((Closeable) httpClient).close();
+ } catch (final IOException ignore) {
+ }
}
}
}