diff --git a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieUtils.java b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieUtils.java index 83affd3f062..df6c9a75dd3 100644 --- a/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieUtils.java +++ b/contrib/views/wfmanager/src/main/java/org/apache/oozie/ambari/view/OozieUtils.java @@ -44,6 +44,7 @@ public String generateConfigXml(Map map) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); db = dbf.newDocumentBuilder(); Document doc = db.newDocument(); Element configElement = doc.createElement("configuration"); @@ -80,6 +81,7 @@ public String getJobPathPropertyKey(JobType jobType) { public JobType deduceJobType(String xml) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); DocumentBuilder db = null; db = dbf.newDocumentBuilder(); @@ -96,7 +98,7 @@ public JobType deduceJobType(String xml) { return JobType.BUNDLE; } throw new RuntimeException("invalid xml submitted"); - } catch (Exception e) { + } catch (ParserConfigurationException | Exception e) { throw new RuntimeException(e); } } @@ -114,6 +116,7 @@ public String deduceWorkflowSchemaVersionFromJson(String json) { public String deduceWorkflowNameFromXml(String xml) { try { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); DocumentBuilder db = dbf.newDocumentBuilder(); InputSource is = new InputSource(); is.setCharacterStream(new StringReader(xml)); @@ -121,7 +124,7 @@ public String deduceWorkflowNameFromXml(String xml) { String name = doc.getDocumentElement().getAttributeNode("name").getValue(); return name; - } catch (Exception e) { + } catch (ParserConfigurationException | Exception e) { throw new RuntimeException(e); } } @@ -130,6 +133,7 @@ public String generateWorkflowXml(String actionNodeXml) { DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db; try { + dbf.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); db = dbf.newDocumentBuilder(); Document doc = db.newDocument();