FOP-3038: Allow sections which need security permissions to be run when AllPermission denied in caller code

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/commons/trunk@1895651 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java b/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java
index b91a728..1a1d341 100644
--- a/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java
+++ b/src/main/java/org/apache/xmlgraphics/image/loader/impl/AbstractImageSessionContext.java
@@ -29,6 +29,8 @@
 import java.lang.reflect.Proxy;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import javax.imageio.ImageIO;
 import javax.imageio.stream.ImageInputStream;
@@ -59,11 +61,16 @@
     private static boolean noSourceReuse;
 
     static {
-        //TODO Temporary measure to track down a problem
-        //See: http://markmail.org/message/k6mno3jsxmovaz2e
-        String noSourceReuseString = System.getProperty(
-                         AbstractImageSessionContext.class.getName() + ".no-source-reuse");
-        noSourceReuse = Boolean.valueOf(noSourceReuseString);
+        noSourceReuse = AccessController.doPrivileged(
+            new PrivilegedAction<Boolean>() {
+                public Boolean run() {
+                    //See: http://markmail.org/message/k6mno3jsxmovaz2e
+                    String noSourceReuseString = System.getProperty(
+                            AbstractImageSessionContext.class.getName() + ".no-source-reuse");
+                    return Boolean.valueOf(noSourceReuseString);
+                }
+            }
+        );
     }
 
     private final FallbackResolver fallbackResolver;