cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dk...@apache.org
Subject svn commit: r1559257 - /cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
Date Fri, 17 Jan 2014 21:43:42 GMT
Author: dkulp
Date: Fri Jan 17 21:43:42 2014
New Revision: 1559257

URL: http://svn.apache.org/r1559257
Log:
[CXF-5442] Attempt to make sure no references are in place

Modified:
    cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java

Modified: cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java?rev=1559257&r1=1559256&r2=1559257&view=diff
==============================================================================
--- cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
(original)
+++ cxf/trunk/rt/transports/http/src/main/java/org/apache/cxf/transport/http/CXFAuthenticator.java
Fri Jan 17 21:43:42 2014
@@ -69,7 +69,13 @@ public class CXFAuthenticator extends Au
             }
             
             try {
-                ClassLoader loader = new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
+                ClassLoader loader = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
{
+                        public ClassLoader run() {
+                            return new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader());
+                        }
+                    }, null);
+                
+                
                 Method m = ClassLoader.class.getDeclaredMethod("defineClass", String.class,

                                                                byte[].class, Integer.TYPE,
Integer.TYPE);
                 
@@ -94,9 +100,15 @@ public class CXFAuthenticator extends Au
                     });
 
                 }
+                try {
+                    //clear the acc field that can hold onto the webapp classloader
+                    Field f = loader.getClass().getDeclaredField("acc");
+                    ReflectionUtil.setAccessible(f).set(loader, null);
+                } catch (Throwable t) {
+                    //ignore
+                }
             } catch (Throwable t) {
                 //ignore
-                t.printStackTrace();
             }
         }
     }



Mime
View raw message