From 9d69b5d4b215f691496a87eea974179a88885383 Mon Sep 17 00:00:00 2001 From: slaws Date: Wed, 17 Aug 2011 16:04:45 +0000 Subject: TUSCANY-3922 - apply Jennifer's patch to add some missing doPrivileged calls around various classloader calls. Thanks for the patch Jennifer. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1158793 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/databinding/javabeans/JavaBeansDataBinding.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'sca-java-2.x/trunk/modules/databinding/src') diff --git a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java index 5e5774f338..3721fb7e63 100644 --- a/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java +++ b/sca-java-2.x/trunk/modules/databinding/src/main/java/org/apache/tuscany/sca/databinding/javabeans/JavaBeansDataBinding.java @@ -19,6 +19,7 @@ package org.apache.tuscany.sca.databinding.javabeans; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -30,6 +31,8 @@ import java.io.OutputStream; import java.io.Serializable; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.logging.Logger; import org.apache.tuscany.sca.databinding.BaseDataBinding; @@ -88,7 +91,16 @@ public class JavaBeansDataBinding extends BaseDataBinding { // because Collection classes are loaded by the System ClassLoader but their contents // may be loaded from another ClassLoader // - ClassLoader classLoaderToUse = targetDataType.getPhysical().getClassLoader(); + final DataType fTargetDataType = targetDataType; + ClassLoader classLoaderToUse = AccessController.doPrivileged(new PrivilegedAction() { + public ClassLoader run() { + ClassLoader cl = fTargetDataType.getPhysical().getClassLoader(); + return cl; + } + }); + + + if (classLoaderToUse == null) { classLoaderToUse = clazz.getClassLoader(); } -- cgit v1.2.3