[jbossws-commits] JBossWS SVN: r19141 - stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Mon Dec 15 05:20:46 EST 2014
Author: asoldano
Date: 2014-12-15 05:20:45 -0500 (Mon, 15 Dec 2014)
New Revision: 19141
Added:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
Modified:
stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
Log:
[JBWS-3858] Misconfigured TCCL during endpoint method invocations when Spring integration is enabled
Modified: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2014-12-12 15:06:01 UTC (rev 19140)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/JBossWSInvoker.java 2014-12-15 10:20:45 UTC (rev 19141)
@@ -174,10 +174,13 @@
BusFactory.setThreadDefaultBus(null);
setNamespaceContextSelector(exchange);
+ ClassLoader cl = SecurityActions.getContextClassLoader();
+ SecurityActions.setContextClassLoader(serviceObject.getClass().getClassLoader());
try {
invHandler.invoke(ep, inv);
return inv.getReturnValue();
} finally {
+ SecurityActions.setContextClassLoader(cl);
//make sure the right bus is restored after coming back from the endpoint method
BusFactory.setThreadDefaultBus(threadBus);
clearNamespaceContextSelector(exchange);
Added: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
===================================================================
--- stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java (rev 0)
+++ stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java 2014-12-15 10:20:45 UTC (rev 19141)
@@ -0,0 +1,82 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.wsf.stack.cxf;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ *
+ * @author alessio.soldano at jboss.com
+ * @since 17-Feb-2010
+ *
+ */
+class SecurityActions
+{
+ /**
+ * Get context classloader.
+ *
+ * @return the current context classloader
+ */
+ static ClassLoader getContextClassLoader()
+ {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
+ /**
+ * Set context classloader.
+ *
+ * @param classLoader the classloader
+ */
+ static void setContextClassLoader(final ClassLoader classLoader)
+ {
+ if (System.getSecurityManager() == null)
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ }
+ else
+ {
+ AccessController.doPrivileged(new PrivilegedAction<Object>()
+ {
+ public Object run()
+ {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+ }
+ }
+
+}
Property changes on: stack/cxf/trunk/modules/server/src/main/java/org/jboss/wsf/stack/cxf/SecurityActions.java
___________________________________________________________________
Added: svn:keywords
+ Rev Date
Added: svn:eol-style
+ native
More information about the jbossws-commits
mailing list