summaryrefslogtreecommitdiffstats
path: root/branches
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-09-14 09:00:20 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2009-09-14 09:00:20 +0000
commit67e95cc7ea25abd3bd82d0468ddda64455bcdd7e (patch)
treeacbf86ee9950464de68b6bf7d48116b1cf8f5376 /branches
parent81b964601f0ae084a65953096b8d71afa4b9bc9a (diff)
TUSCANY-3235 - Java2 security problem - Thanks for the patch Hasan
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@814529 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches')
-rw-r--r--branches/sca-java-1.x/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.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java b/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
index 4eaaf3db7f..c685f5cc19 100644
--- a/branches/sca-java-1.x/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java
+++ b/branches/sca-java-1.x/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