Set the secure processing feature on the TransformerFactory

This commit is contained in:
Colm O hEigeartaigh 2018-11-28 18:10:32 +00:00
parent 097f82a246
commit a72b59253f
1 changed files with 2 additions and 0 deletions

View File

@ -209,6 +209,8 @@ public class CreateCommand extends AbstractCommand {
// utlity method to write an xml source to file // utlity method to write an xml source to file
private void writeToFile(Source src, File file) throws TransformerException { private void writeToFile(Source src, File file) throws TransformerException {
TransformerFactory tFactory = TransformerFactory.newInstance(); TransformerFactory tFactory = TransformerFactory.newInstance();
tFactory.setFeature(javax.xml.XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
Transformer fileTransformer = tFactory.newTransformer(); Transformer fileTransformer = tFactory.newTransformer();
Result res = new StreamResult(file); Result res = new StreamResult(file);