HTTPCLIENT-1313: Fixed IllegalStateException in deprecated ThreadSafeClientConnManager

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1440520 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Oleg Kalnichevski 2013-01-30 16:59:20 +00:00
parent 90fc40bbf2
commit e37f99ccda
3 changed files with 11 additions and 6 deletions

View File

@ -1,6 +1,9 @@
Changes since 4.3 ALPHA1
-------------------
* [HTTPCLIENT-1313] Fixed IllegalStateException in deprecated ThreadSafeClientConnManager
Contributed by Oleg Kalnichevski <olegk at apache.org>
* [HTTPCLIENT-1305] Ensure chunking is disabled when applying Base64 encoding.
Contributed by Oleg Kalnichevski <olegk at apache.org>

View File

@ -129,8 +129,9 @@ public abstract class AbstractPoolEntry {
Args.notNull(route, "Route");
Args.notNull(params, "HTTP parameters");
Asserts.notNull(this.tracker, "Route tracker");
Asserts.check(!this.tracker.isConnected(), "Connection already open");
if (this.tracker != null) {
Asserts.check(!this.tracker.isConnected(), "Connection already open");
}
// - collect the arguments
// - call the operator
// - update the tracking data

View File

@ -42,7 +42,7 @@ import org.apache.http.conn.params.ConnPerRouteBean;
import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.conn.DefaultClientConnectionOperator;
import org.apache.http.impl.conn.PoolingClientConnectionManager;
import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.impl.conn.SchemeRegistryFactory;
import org.apache.http.params.HttpParams;
import org.apache.http.util.Args;
@ -66,7 +66,7 @@ import org.apache.http.util.Asserts;
*
* @since 4.0
*
* @deprecated (4.2) use {@link PoolingClientConnectionManager}
* @deprecated (4.2) use {@link PoolingHttpClientConnectionManager}
*/
@ThreadSafe
@Deprecated
@ -249,8 +249,9 @@ public class ThreadSafeClientConnManager implements ClientConnectionManager {
Args.check(conn instanceof BasicPooledConnAdapter, "Connection class mismatch, " +
"connection not obtained from this manager");
final BasicPooledConnAdapter hca = (BasicPooledConnAdapter) conn;
Asserts.check(hca.getPoolEntry() == null, "Connection not obtained from this manager");
Asserts.check(hca.getManager() == this, "Connection not obtained from this manager");
if (hca.getPoolEntry() != null) {
Asserts.check(hca.getManager() == this, "Connection not obtained from this manager");
}
synchronized (hca) {
final BasicPoolEntry entry = (BasicPoolEntry) hca.getPoolEntry();
if (entry == null) {