You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by fa...@apache.org on 2018/09/07 15:22:22 UTC
svn commit: r1840305 -
/xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/DocumentHelper.java
Author: fanningpj
Date: Fri Sep 7 15:22:22 2018
New Revision: 1840305
URL: http://svn.apache.org/viewvc?rev=1840305&view=rev
Log:
XMLBEANS-519 issue using firefly parser
Modified:
xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/DocumentHelper.java
Modified: xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/DocumentHelper.java
URL: http://svn.apache.org/viewvc/xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/DocumentHelper.java?rev=1840305&r1=1840304&r2=1840305&view=diff
==============================================================================
--- xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/DocumentHelper.java (original)
+++ xmlbeans/trunk/src/common/org/apache/xmlbeans/impl/common/DocumentHelper.java Fri Sep 7 15:22:22 2018
@@ -18,6 +18,7 @@ package org.apache.xmlbeans.impl.common;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Method;
+import java.util.concurrent.TimeUnit;
import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
@@ -35,6 +36,7 @@ import org.xml.sax.SAXParseException;
public final class DocumentHelper {
private static XBLogger logger = XBLogFactory.getLogger(DocumentHelper.class);
+ private static long lastLog;
private DocumentHelper() {}
@@ -130,12 +132,22 @@ public final class DocumentHelper {
} catch (ClassNotFoundException e) {
// continue without log, this is expected in some setups
} catch (Throwable e) { // NOSONAR - also catch things like NoClassDefError here
- logger.log(XBLogger.WARN, "SAX Security Manager could not be setup", e);
+ if(System.currentTimeMillis() > lastLog + TimeUnit.MINUTES.toMillis(5)) {
+ logger.log(XBLogger.WARN, "DocumentBuilderFactory Security Manager could not be setup [log suppressed for 5 minutes]", e);
+ lastLog = System.currentTimeMillis();
+ }
}
}
// separate old version of Xerces not found => use the builtin way of setting the property
- dbf.setAttribute(XMLBeansConstants.ENTITY_EXPANSION_LIMIT, options.getEntityExpansionLimit());
+ try {
+ dbf.setAttribute(XMLBeansConstants.ENTITY_EXPANSION_LIMIT, options.getEntityExpansionLimit());
+ } catch (Throwable e) {
+ if(System.currentTimeMillis() > lastLog + TimeUnit.MINUTES.toMillis(5)) {
+ logger.log(XBLogger.WARN, "DocumentBuilderFactory Entity Expansion Limit could not be setup [log suppressed for 5 minutes]", e);
+ lastLog = System.currentTimeMillis();
+ }
+ }
}
/**
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org