Author: alessio.soldano(a)jboss.com
Date: 2013-07-17 12:05:58 -0400 (Wed, 17 Jul 2013)
New Revision: 17796
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
Log:
Adding privileged block for getting TCCL
Modified:
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java
===================================================================
---
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2013-07-17
16:01:22 UTC (rev 17795)
+++
spi/trunk/src/main/java/org/jboss/wsf/spi/metadata/j2ee/serviceref/UnifiedServiceRefMetaData.java 2013-07-17
16:05:58 UTC (rev 17796)
@@ -26,6 +26,8 @@
import java.io.Serializable;
import java.net.MalformedURLException;
import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -235,7 +237,7 @@
throw MESSAGES.cannotFindFile(e, mappingFile);
}
} else {
- mappingURL =
Thread.currentThread().getContextClassLoader().getResource(mappingFile);
+ mappingURL = getContextClassLoader().getResource(mappingFile);
}
}
return mappingURL;
@@ -348,7 +350,7 @@
throw MESSAGES.cannotFindFile(e, wsdlOverride);
}
} else {
- wsdlLocation =
Thread.currentThread().getContextClassLoader().getResource(wsdlOverride);
+ wsdlLocation = getContextClassLoader().getResource(wsdlOverride);
}
}
}
@@ -371,7 +373,7 @@
throw MESSAGES.cannotFindFile(e, wsdlFile);
}
} else {
- wsdlLocation =
Thread.currentThread().getContextClassLoader().getResource(wsdlFile);
+ wsdlLocation = getContextClassLoader().getResource(wsdlFile);
}
}
}
@@ -428,6 +430,24 @@
this.handlerChain = handlerChain;
}
+ private static ClassLoader getContextClassLoader()
+ {
+ if (System.getSecurityManager() == null)
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ else
+ {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>()
+ {
+ public ClassLoader run()
+ {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ }
+ }
+
public String toString()
{
StringBuilder str = new StringBuilder();
Show replies by date