rubenada commented on code in PR #2892:
URL: https://github.com/apache/calcite/pull/2892#discussion_r963051068
##########
core/src/test/java/org/apache/calcite/test/SqlXmlFunctionsTest.java:
##########
@@ -36,6 +36,18 @@
*/
class SqlXmlFunctionsTest {
+ private static final String XML = "<document>string</document>";
+ private static final String FILE =
System.getProperty("os.name").startsWith("Windows")
+ ? "file:///C:/Windows/System32/drivers/etc/hosts"
+ : "file:///etc/hosts";
Review Comment:
Switched to temp file
##########
core/src/main/java/org/apache/calcite/runtime/XmlFunctions.java:
##########
@@ -215,6 +238,27 @@ private static String convertNodeToString(Node node)
throws TransformerException
return writer.toString();
}
+ private static Node getDocumentNode(final String xml) {
+ final DocumentBuilderFactory documentBuilderFactory =
DocumentBuilderFactory.newInstance();
+ documentBuilderFactory.setXIncludeAware(false);
+ documentBuilderFactory.setExpandEntityReferences(false);
+ documentBuilderFactory.setNamespaceAware(true);
+ try {
+
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ documentBuilderFactory
+ .setFeature("http://apache.org/xml/features/disallow-doctype-decl",
true);
+ } catch (final ParserConfigurationException e) {
+ throw new IllegalArgumentException("Document Builder configuration
failed", e);
Review Comment:
Changed into IllegalStateException
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]