ppkarwasz commented on code in PR #2635:
URL: https://github.com/apache/activemq/pull/2635#discussion_r4179830040


##########
activemq-console/src/main/java/org/apache/activemq/console/command/CreateCommand.java:
##########
@@ -158,10 +160,10 @@ protected void copyActivemqConf(File srcBase, File 
targetBase, String activemqCo
         File dest = new File(targetBase, DEFAULT_TARGET_ACTIVEMQ_CONF);
         context.print("Copying from: " + src.getCanonicalPath() + "\n          
to: " + dest.getCanonicalPath());
 
-        DocumentBuilder builder = 
XmlFactories.getSafeDocumentBuilderFactory().newDocumentBuilder();
+        DocumentBuilder builder = 
SecureDocumentBuilderFactory.newNSInstance().newDocumentBuilder();
         Element docElem = builder.parse(src).getDocumentElement();
 
-        XPath xpath = XPathFactory.newInstance().newXPath();
+        XPath xpath = SecureXPathFactory.newInstance().newXPath();
         Attr brokerNameAttr = (Attr) xpath.evaluate(DEFAULT_BROKERNAME_XPATH, 
docElem, XPathConstants.NODE);

Review Comment:
   Unless I am mistaken, all ActiveMQ configurations need to use namespaces, 
otherwise Spring will not accept them. Therefore you can also set a 
`NamespaceContext` on the `XPath` (there is a `SimpleNamespaceContext` in 
`spring-core` if you don't want to create your own), bind the namespaces and 
use something like `/b:beans/a:broker/@brokerName`.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to