Author: darran.lofthouse(a)jboss.com
Date: 2008-11-20 10:42:41 -0500 (Thu, 20 Nov 2008)
New Revision: 8767
Modified:
common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java
Log:
[JBPAPP-1439] Allow the Xerces defer-node-expansion optimisation to be disabled.
Modified:
common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java
===================================================================
---
common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java 2008-11-20
15:28:37 UTC (rev 8766)
+++
common/branches/jbossws-common-1.0.0.GA_CP/src/main/java/org/jboss/wsf/common/DOMUtils.java 2008-11-20
15:42:41 UTC (rev 8767)
@@ -68,10 +68,11 @@
{
private static Logger log = Logger.getLogger(DOMUtils.class);
+ private static final String DISABLE_DEFERRED_NODE_EXPANSION =
"org.jboss.ws.disable_deferred_node_expansion";
+
// All elements created by the same thread are created by the same builder and belong
to the same doc
- private static ThreadLocal documentThreadLocal = new ThreadLocal();
- private static ThreadLocal builderThreadLocal = new ThreadLocal()
- {
+ private static ThreadLocal<Document> documentThreadLocal = new
ThreadLocal<Document>();
+ private static ThreadLocal<DocumentBuilder> builderThreadLocal = new
ThreadLocal<DocumentBuilder>() {
protected Object initialValue()
{
try
@@ -79,6 +80,13 @@
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
factory.setNamespaceAware(true);
+
+ boolean disableDeferredNodeExpansion =
Boolean.getBoolean(DISABLE_DEFERRED_NODE_EXPANSION);
+ if (disableDeferredNodeExpansion == true)
+ {
+
factory.setFeature("http://apache.org/xml/features/dom/defer-node-ex...;,
false);
+ }
+
DocumentBuilder builder = factory.newDocumentBuilder();
setEntityResolver(builder);
return builder;