[HTTPCLIENT-1727] org.apache.http.impl.client.AbstractHttpClient#createClientConnectionManager Does not account for context class loader.

git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/branches/4.5.x@1733406 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary D. Gregory 2016-03-03 01:59:34 +00:00
parent 7663e6a596
commit eda8dc5d32
2 changed files with 21 additions and 1 deletions

View File

@ -1,3 +1,17 @@
Release 4.5.3
-------------------
HttpClient 4.5.3 (GA) is a maintenance release that fixes a number of minor defects found since 4.5.2.
Please note that as of 4.4 HttpClient requires Java 1.6 or newer.
Changelog:
-------------------
* [HTTPCLIENT-1727] org.apache.http.impl.client.AbstractHttpClient#createClientConnectionManager Does not account for context class loader.
Contributed by Charles Allen <charles dot allen at metamarkets dot com>
Release 4.5.2
-------------------

View File

@ -327,9 +327,15 @@ public abstract class AbstractHttpClient extends CloseableHttpClient {
final String className = (String) params.getParameter(
ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
final ClassLoader contextLoader = Thread.currentThread().getContextClassLoader();
if (className != null) {
try {
final Class<?> clazz = Class.forName(className);
final Class<?> clazz;
if (contextLoader != null) {
clazz = Class.forName(className, true, contextLoader);
} else {
clazz = Class.forName(className);
}
factory = (ClientConnectionManagerFactory) clazz.newInstance();
} catch (final ClassNotFoundException ex) {
throw new IllegalStateException("Invalid class name: " + className);