|
@@ -122,6 +122,8 @@ import org.apache.hadoop.security.UserGroupInformation;
|
|
|
import org.apache.hadoop.security.token.Token;
|
|
|
import org.apache.hadoop.test.GenericTestUtils;
|
|
|
import org.apache.hadoop.test.LambdaTestUtils;
|
|
|
+import org.apache.hadoop.util.XMLUtils;
|
|
|
+
|
|
|
import org.slf4j.event.Level;
|
|
|
import org.junit.AfterClass;
|
|
|
import org.junit.Assert;
|
|
@@ -558,7 +560,7 @@ public class TestOfflineImageViewer {
|
|
|
try (RandomAccessFile r = new RandomAccessFile(originalFsimage, "r")) {
|
|
|
v.visit(r);
|
|
|
}
|
|
|
- SAXParserFactory spf = SAXParserFactory.newInstance();
|
|
|
+ SAXParserFactory spf = XMLUtils.newSecureSAXParserFactory();
|
|
|
SAXParser parser = spf.newSAXParser();
|
|
|
final String xml = output.toString();
|
|
|
ECXMLHandler ecxmlHandler = new ECXMLHandler();
|
|
@@ -984,13 +986,13 @@ public class TestOfflineImageViewer {
|
|
|
|
|
|
private void deleteINodeFromXML(File inputFile, File outputFile,
|
|
|
List<Long> corruptibleIds) throws Exception {
|
|
|
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
|
|
|
+ DocumentBuilderFactory docFactory = XMLUtils.newSecureDocumentBuilderFactory();
|
|
|
DocumentBuilder docBuilder = docFactory.newDocumentBuilder();
|
|
|
Document doc = docBuilder.parse(inputFile);
|
|
|
|
|
|
properINodeDelete(corruptibleIds, doc);
|
|
|
|
|
|
- TransformerFactory transformerFactory = TransformerFactory.newInstance();
|
|
|
+ TransformerFactory transformerFactory = XMLUtils.newSecureTransformerFactory();
|
|
|
Transformer transformer = transformerFactory.newTransformer();
|
|
|
DOMSource source = new DOMSource(doc);
|
|
|
StreamResult result = new StreamResult(outputFile);
|
|
@@ -1323,10 +1325,9 @@ public class TestOfflineImageViewer {
|
|
|
v.visit(new RandomAccessFile(originalFsimage, "r"));
|
|
|
final String xml = output.toString();
|
|
|
|
|
|
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
|
|
|
+ DocumentBuilderFactory dbf = XMLUtils.newSecureDocumentBuilderFactory();
|
|
|
DocumentBuilder db = dbf.newDocumentBuilder();
|
|
|
- InputSource is = new InputSource();
|
|
|
- is.setCharacterStream(new StringReader(xml));
|
|
|
+ InputSource is = new InputSource(new StringReader(xml));
|
|
|
Document dom = db.parse(is);
|
|
|
NodeList ecSection = dom.getElementsByTagName(ERASURE_CODING_SECTION_NAME);
|
|
|
assertEquals(1, ecSection.getLength());
|