Author: richard.opalka(a)jboss.com
Date: 2011-04-04 16:37:22 -0400 (Mon, 04 Apr 2011)
New Revision: 13996
Modified:
common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/common/DOMUtils.java
Log:
[JBWS-3261] DOCTYPEs are not allowed by default - users can use JVM property
-Dorg.jboss.ws.enable_doctype_decl=true to allow them
Modified:
common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/common/DOMUtils.java
===================================================================
---
common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/common/DOMUtils.java 2011-04-04
20:36:47 UTC (rev 13995)
+++
common/branches/jbossws-common-1.1.0/src/main/java/org/jboss/wsf/common/DOMUtils.java 2011-04-04
20:37:22 UTC (rev 13996)
@@ -73,11 +73,14 @@
private static final String DISABLE_DEFERRED_NODE_EXPANSION =
"org.jboss.ws.disable_deferred_node_expansion";
private static final String DEFER_NODE_EXPANSION_FEATURE =
"http://apache.org/xml/features/dom/defer-node-expansion";
+ private static final String ENABLE_DOCTYPE_DECL =
"org.jboss.ws.enable_doctype_decl";
+ private static final String DISALLOW_DOCTYPE_DECL_FEATURE =
"http://apache.org/xml/features/disallow-doctype-decl";
private static String documentBuilderFactoryName;
private static final boolean alwaysResolveFactoryName =
Boolean.getBoolean(Constants.ALWAYS_RESOLVE_DOCUMENT_BUILDER_FACTORY);
private static final boolean disableDeferedNodeExpansion =
Boolean.getBoolean(DISABLE_DEFERRED_NODE_EXPANSION);
+ private static final boolean enableDoctypeDeclaration =
Boolean.getBoolean(ENABLE_DOCTYPE_DECL);
// All elements created by the same thread are created by the same builder and belong
to the same doc
private static ThreadLocal<Document> documentThreadLocal = new
ThreadLocal<Document>();
@@ -116,6 +119,10 @@
{
factory.setFeature(DEFER_NODE_EXPANSION_FEATURE, false);
}
+ if (!enableDoctypeDeclaration)
+ {
+ factory.setFeature(DISALLOW_DOCTYPE_DECL_FEATURE, true);
+ }
}
catch (ParserConfigurationException pce)
{
Show replies by date