You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@santuario.apache.org by mu...@apache.org on 2015/06/18 15:07:38 UTC

svn commit: r1686210 - /santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/xml/security/utils/IgnoreAllErrorHandler.java

Author: mullan
Date: Thu Jun 18 13:07:38 2015
New Revision: 1686210

URL: http://svn.apache.org/r1686210
Log:
Wraps calls to System.getProperty in doPrivileged.

Modified:
    santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/xml/security/utils/IgnoreAllErrorHandler.java

Modified: santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/xml/security/utils/IgnoreAllErrorHandler.java
URL: http://svn.apache.org/viewvc/santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/xml/security/utils/IgnoreAllErrorHandler.java?rev=1686210&r1=1686209&r2=1686210&view=diff
==============================================================================
--- santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/xml/security/utils/IgnoreAllErrorHandler.java (original)
+++ santuario/xml-security-java/branches/1.5.x-fixes/src/main/java/org/apache/xml/security/utils/IgnoreAllErrorHandler.java Thu Jun 18 13:07:38 2015
@@ -31,19 +31,30 @@ import org.xml.sax.SAXParseException;
 public class IgnoreAllErrorHandler implements ErrorHandler {
 
     /** {@link org.apache.commons.logging} logging facility */
-    private static org.apache.commons.logging.Log log =
+    private static final org.apache.commons.logging.Log log =
         org.apache.commons.logging.LogFactory.getLog(IgnoreAllErrorHandler.class);
 
     /** Field throwExceptions */
     private static final boolean warnOnExceptions =
-        System.getProperty("org.apache.xml.security.test.warn.on.exceptions", "false").equals("true");
+        getProperty("org.apache.xml.security.test.warn.on.exceptions");
 
     /** Field throwExceptions           */
     private static final boolean throwExceptions = 
-        System.getProperty("org.apache.xml.security.test.throw.exceptions", "false").equals("true");
+        getProperty("org.apache.xml.security.test.throw.exceptions");
 
+    private static boolean getProperty(final String name) {
+        return java.security.AccessController.doPrivileged(
+                new java.security.PrivilegedAction<Boolean>() {
+
+                    @Override
+                    public Boolean run() {
+                        return Boolean.getBoolean(name);
+                    }
+                });
+    }
 
     /** @inheritDoc */
+    @Override
     public void warning(SAXParseException ex) throws SAXException {
         if (IgnoreAllErrorHandler.warnOnExceptions) {
             log.warn("", ex);
@@ -55,6 +66,7 @@ public class IgnoreAllErrorHandler imple
 
 
     /** @inheritDoc */
+    @Override
     public void error(SAXParseException ex) throws SAXException {
         if (IgnoreAllErrorHandler.warnOnExceptions) {
             log.error("", ex);
@@ -66,6 +78,7 @@ public class IgnoreAllErrorHandler imple
 
 
     /** @inheritDoc */
+    @Override
     public void fatalError(SAXParseException ex) throws SAXException {
         if (IgnoreAllErrorHandler.warnOnExceptions) {
             log.warn("", ex);