summaryrefslogtreecommitdiffstats
path: root/cps-service/src
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src')
-rw-r--r--cps-service/src/main/java/org/onap/cps/utils/XmlFileUtils.java13
1 files changed, 4 insertions, 9 deletions
diff --git a/cps-service/src/main/java/org/onap/cps/utils/XmlFileUtils.java b/cps-service/src/main/java/org/onap/cps/utils/XmlFileUtils.java
index 10e1f50b54..09f2e16c6a 100644
--- a/cps-service/src/main/java/org/onap/cps/utils/XmlFileUtils.java
+++ b/cps-service/src/main/java/org/onap/cps/utils/XmlFileUtils.java
@@ -50,8 +50,8 @@ import org.xml.sax.SAXException;
public class XmlFileUtils {
private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- private static final TransformerFactory transformerFactory = TransformerFactory.newInstance();
private static boolean isNewDocumentBuilderFactoryInstance = true;
+ private static final TransformerFactory transformerFactory = TransformerFactory.newInstance();
private static boolean isNewTransformerFactoryInstance = true;
private static final Pattern XPATH_PROPERTY_REGEX =
Pattern.compile("\\[@(\\S{1,100})=['\\\"](\\S{1,100})['\\\"]\\]");
@@ -161,15 +161,9 @@ public class XmlFileUtils {
}
}
- private static DocumentBuilderFactory getDocumentBuilderFactory() throws ParserConfigurationException {
+ private static DocumentBuilderFactory getDocumentBuilderFactory() {
+
if (isNewDocumentBuilderFactoryInstance) {
- documentBuilderFactory.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
- documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
- documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
- documentBuilderFactory.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false);
- documentBuilderFactory.setXIncludeAware(false);
- documentBuilderFactory.setExpandEntityReferences(false);
- documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
documentBuilderFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_SCHEMA, "");
isNewDocumentBuilderFactoryInstance = false;
@@ -179,6 +173,7 @@ public class XmlFileUtils {
}
private static TransformerFactory getTransformerFactory() {
+
if (isNewTransformerFactoryInstance) {
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");