diff options
Diffstat (limited to 'branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca')
-rw-r--r-- | branches/sca-java-1.5.1/modules/databinding-jaxb/src/main/java/org/apache/tuscany/sca/databinding/jaxb/JAXBContextCache.java | 12 |
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 |