summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5.1/modules
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-09-14 08:44:42 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-09-14 08:44:42 +0000
commit6fb01453f4d9d760dc2a9117d421a3639c4a6b90 (patch)
treeb9c765b02be9bd34aaf24be92ee8a7a64454ae4c /branches/sca-java-1.5.1/modules
parent573f79b1c2006b95327af483d523332eee8c84d3 (diff)
TUSCANY-3235 - Java2 security problem - Thanks for the patch Hasan
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@814524 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.5.1/modules')
-rw-r--r--branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
index 4eaaf3db7f..c685f5cc19 100644
--- a/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
+++ b/branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
@@ -24,8 +24,10 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.lang.ref.SoftReference;
+import java.net.MalformedURLException;
import java.net.URI;
import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.security.PrivilegedActionException;
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
@@ -464,11 +466,19 @@ public class JAXBContextCache {
for (Class<?> cls : classes) {
Package pkg = getPackage(cls);
if (pkg != null) {
- pkgs.put(pkg, cls.getClassLoader());
+ pkgs.put(pkg, getClassLoader(cls));
}
}
return pkgs;
}
+
+ private static ClassLoader getClassLoader(final Class<?> cls) {
+ return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run(){ //throws ClassNotFoundException{
+ return cls.getClassLoader();
+ }
+ });
+ }
/**
* Find ObjectFactory and indexed JAXB classes for the package