summaryrefslogtreecommitdiff
path: root/xmerge
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-03-01 09:51:23 +0000
committerCaolán McNamara <caolanm@redhat.com>2016-03-01 09:55:29 +0000
commit1fb6a3aa87f6f68194246f8de0d62796a98ddce2 (patch)
treea7ff276195334e7df34122ea84b705116a24107b /xmerge
parent3ff17bda5ba3e627e9b996506dc72b68cf67483b (diff)
coverity#1326847 DP: Use doPrivileged
and coverity#1326848 DP: Use doPrivileged Change-Id: Ida9706055ade82cdf901f2f78687ee0270b499c4
Diffstat (limited to 'xmerge')
-rw-r--r--xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java24
1 files changed, 18 insertions, 6 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java
index de377ec43f37..2190ab27c9ce 100644
--- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java
+++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfo.java
@@ -21,6 +21,8 @@ package org.openoffice.xmerge.util.registry;
import java.lang.reflect.Constructor;
import java.net.URL;
import java.net.URLClassLoader;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Iterator;
@@ -101,9 +103,14 @@ public class ConverterInfo {
// Get instance of the PluginFactory.
try {
- URL jarURL = new URL(jarName);
- URLClassLoader loader = new URLClassLoader(new URL[] { jarURL },
- piClassLoader);
+ final URL jarURL = new URL(jarName);
+ final URL[] urls = new URL[] { jarURL };
+ URLClassLoader loader = AccessController.doPrivileged(
+ new PrivilegedAction<URLClassLoader>() {
+ public URLClassLoader run() {
+ return new URLClassLoader(urls, piClassLoader);
+ }
+ });
Class<?> clas = loader.loadClass(piClassImpl);
Class<?>[] argumentTypes = { org.openoffice.xmerge.util.registry.ConverterInfo.class };
Constructor<?> construct = clas.getConstructor(argumentTypes);
@@ -176,9 +183,14 @@ public class ConverterInfo {
// Get instance of the PluginFactory.
try {
- URL jarURL = new URL(jarName);
- URLClassLoader loader = new URLClassLoader(new URL[] { jarURL },
- piClassLoader);
+ final URL jarURL = new URL(jarName);
+ final URL[] urls = new URL[] { jarURL };
+ URLClassLoader loader = AccessController.doPrivileged(
+ new PrivilegedAction<URLClassLoader>() {
+ public URLClassLoader run() {
+ return new URLClassLoader(urls, piClassLoader);
+ }
+ });
Class<?> clas = loader.loadClass(piClassImpl);
Class<?>[] argumentTypes = { org.openoffice.xmerge.util.registry.ConverterInfo.class };
Constructor<?> construct = clas.getConstructor(argumentTypes);