File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
xwiki-platform-core/xwiki-platform-oldcore/src/test/java/com/xpn/xwiki/pdf/impl Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 2323import java .io .ByteArrayOutputStream ;
2424import java .io .StringReader ;
2525
26+ import javax .xml .XMLConstants ;
2627import javax .xml .parsers .DocumentBuilderFactory ;
2728
2829import org .junit .jupiter .api .BeforeEach ;
@@ -153,7 +154,11 @@ void setUp() throws Exception
153154 this .cssProperties = "span { color:red; }" ;
154155
155156 // Set up HTML cleaner.
156- Document htmlDocument = DocumentBuilderFactory .newInstance ().newDocumentBuilder ()
157+ DocumentBuilderFactory factory = DocumentBuilderFactory .newInstance ();
158+ // Prevent network requests to w3.org to fetch the DTD.
159+ factory .setFeature (XMLConstants .FEATURE_SECURE_PROCESSING , true );
160+ factory .setFeature ("http://apache.org/xml/features/nonvalidating/load-external-dtd" , false );
161+ Document htmlDocument = factory .newDocumentBuilder ()
157162 .parse (new ByteArrayInputStream (this .htmlContent .getBytes ()));
158163 HTMLCleanerConfiguration cleanerConfiguration = new DefaultHTMLCleanerConfiguration ();
159164 when (this .htmlCleaner .getDefaultConfiguration ()).thenReturn (cleanerConfiguration );
You can’t perform that action at this time.
0 commit comments