summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-01 16:51:18 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-01 16:51:18 +0000
commit092551bd4fcaabf20fe8698a2b95dcc84549421f (patch)
treea7b8eb3553650ce806ae61809ae7d27bfebb60f4
parent959ac6c9a2ce735b02a2f9fb75234326423695ad (diff)
Create model resolvers in doPrivileged block. The primary concern here is the ClassLoaderModelResolver which extends the URIClassLoader and requires permissions.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1209147 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
index e3a088fd96..12e0238ee9 100644
--- a/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
+++ b/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/resolver/ExtensibleModelResolver.java
@@ -20,6 +20,9 @@
package org.apache.tuscany.sca.contribution.resolver;
import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
import java.util.HashMap;
import java.util.Map;
@@ -94,12 +97,18 @@ public class ExtensibleModelResolver implements ModelResolver {
return resolverInstance;
}
try {
- Constructor<? extends ModelResolver> constructor =
+ final Constructor<? extends ModelResolver> constructor =
resolverClass
.getConstructor(new Class[] {Contribution.class, FactoryExtensionPoint.class});
if (constructor != null) {
- resolverInstance = constructor.newInstance(contribution, modelFactories);
+ resolverInstance = AccessController.doPrivileged(new PrivilegedExceptionAction<ModelResolver>() {
+ public ModelResolver run() throws Exception {
+ ModelResolver resolverInstance = constructor.newInstance(contribution, modelFactories);
+ return resolverInstance;
+ }
+ });
+
resolversByImplementationClass.put(resolverClass, resolverInstance);
resolversByModelType.put(c, resolverInstance);
return resolverInstance;