This is an automated email from the ASF dual-hosted git repository.
jialiang pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git
The following commit(s) were added to refs/heads/branch-2.7 by this push:
new 24de535245 AMBARI-26239: Fix OozieUtils (#3893)
24de535245 is described below
commit 24de5352452f8573176fe516fce16d6b296b8090
Author: coldless177 <[email protected]>
AuthorDate: Mon Nov 25 14:26:11 2024 +0800
AMBARI-26239: Fix OozieUtils (#3893)
* AMBARI-26239: Fix OozieUtils
---
.../src/main/java/org/apache/oozie/ambari/view/OozieUtils.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
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 83affd3f06..df6c9a75dd 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 class OozieUtils {
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 class OozieUtils {
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 class OozieUtils {
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 class OozieUtils {
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 class OozieUtils {
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 class OozieUtils {
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();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]