hc-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject svn commit: r1529480 - /httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Date Sat, 05 Oct 2013 16:41:02 GMT
Author: olegk
Date: Sat Oct  5 16:41:02 2013
New Revision: 1529480

URL: http://svn.apache.org/r1529480
Log:
HTTPCLIENT-1414: ClientConnectionManager should honor context classloader
Contributed by Kohsuke Kawaguchi <kk at kohsuke.org>

Modified:
    httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java

Modified: httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
URL: http://svn.apache.org/viewvc/httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java?rev=1529480&r1=1529479&r2=1529480&view=diff
==============================================================================
--- httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
(original)
+++ httpcomponents/httpclient/branches/4.2.x/httpclient/src/main/java/org/apache/http/impl/client/AbstractHttpClient.java
Sat Oct  5 16:41:02 2013
@@ -314,7 +314,11 @@ public abstract class AbstractHttpClient
                 ClientPNames.CONNECTION_MANAGER_FACTORY_CLASS_NAME);
         if (className != null) {
             try {
-                final Class<?> clazz = Class.forName(className);
+                ClassLoader cl = Thread.currentThread().getContextClassLoader();
+                if (cl == null) {
+                    cl = getClass().getClassLoader();
+                }
+                final Class<?> clazz = Class.forName(className,true, cl);
                 factory = (ClientConnectionManagerFactory) clazz.newInstance();
             } catch (final ClassNotFoundException ex) {
                 throw new IllegalStateException("Invalid class name: " + className);



Mime
View raw message