This is an automated email from the ASF dual-hosted git repository.
fanningpj pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/poi.git
The following commit(s) were added to refs/heads/trunk by this push:
new fa9428511a try to cache xerces security manager (#841)
fa9428511a is described below
commit fa9428511acc4c1a0a4c2bbc6da1645abd49b424
Author: PJ Fanning <[email protected]>
AuthorDate: Fri Jul 11 15:40:14 2025 +0100
try to cache xerces security manager (#841)
---
poi/src/main/java/org/apache/poi/util/XMLHelper.java | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/poi/src/main/java/org/apache/poi/util/XMLHelper.java
b/poi/src/main/java/org/apache/poi/util/XMLHelper.java
index 341062d7de..efeca688a5 100644
--- a/poi/src/main/java/org/apache/poi/util/XMLHelper.java
+++ b/poi/src/main/java/org/apache/poi/util/XMLHelper.java
@@ -253,8 +253,24 @@ public final class XMLHelper {
return factory;
}
+ private static Object _xercesSecurityManager;
+ private static volatile boolean _xercesSecurityManagerSet = false;
private static Object getXercesSecurityManager() {
+ if (_xercesSecurityManagerSet) {
+ return _xercesSecurityManager;
+ } else {
+ synchronized (XMLHelper.class) {
+ if (!_xercesSecurityManagerSet) {
+ _xercesSecurityManager = tryGetXercesSecurityManager();
+ _xercesSecurityManagerSet = true;
+ }
+ }
+ return _xercesSecurityManager;
+ }
+ }
+
+ private static Object tryGetXercesSecurityManager() {
// Try built-in JVM one first, standalone if not
for (String securityManagerClassName : SECURITY_MANAGERS) {
try {
@@ -272,7 +288,6 @@ public final class XMLHelper {
logThrowable(e, "SAX Feature unsupported",
securityManagerClassName);
}
}
-
return null;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]