3737import javax .xml .parsers .SAXParser ;
3838import javax .xml .parsers .SAXParserFactory ;
3939import javax .xml .stream .XMLInputFactory ;
40- import javax .xml .stream .XMLResolver ;
4140import javax .xml .transform .Transformer ;
4241import javax .xml .transform .TransformerConfigurationException ;
4342import javax .xml .transform .TransformerFactory ;
@@ -124,8 +123,6 @@ public void fatalError(SAXParseException exception) throws SAXException {
124123 private static final AtomicInteger POOL_GENERATION = new AtomicInteger ();
125124 private static final EntityResolver IGNORING_SAX_ENTITY_RESOLVER =
126125 (publicId , systemId ) -> new InputSource (new StringReader ("" ));
127- private static final XMLResolver IGNORING_STAX_ENTITY_RESOLVER =
128- (publicID , systemID , baseURI , namespace ) -> "" ;
129126 /**
130127 * Parser pool size
131128 */
@@ -295,7 +292,7 @@ public static DocumentBuilder getDocumentBuilder() throws TikaException {
295292 * If a factory is not explicitly specified, then a default factory
296293 * instance is created and returned. The default factory instance is
297294 * configured to be namespace-aware and to apply reasonable security
298- * using the {@link #IGNORING_STAX_ENTITY_RESOLVER} .
295+ * precautions .
299296 *
300297 * @return StAX input factory
301298 * @since Apache Tika 1.13
@@ -305,13 +302,12 @@ public static XMLInputFactory getXMLInputFactory() {
305302 if (LOG .isDebugEnabled ()) {
306303 LOG .debug ("XMLInputFactory class {}" , factory .getClass ());
307304 }
308-
305+ factory . setProperty ( XMLConstants . ACCESS_EXTERNAL_DTD , "" );
309306 tryToSetStaxProperty (factory , XMLInputFactory .IS_NAMESPACE_AWARE , true );
310307 tryToSetStaxProperty (factory , XMLInputFactory .IS_VALIDATING , false );
311308 tryToSetStaxProperty (factory , XMLInputFactory .SUPPORT_DTD , false );
312309 tryToSetStaxProperty (factory , XMLInputFactory .IS_SUPPORTING_EXTERNAL_ENTITIES , false );
313310
314- factory .setXMLResolver (IGNORING_STAX_ENTITY_RESOLVER );
315311 trySetStaxSecurityManager (factory );
316312 return factory ;
317313 }
@@ -1255,7 +1251,7 @@ public static DocumentBuilder getDocumentBuilder(ParseContext context) throws Ti
12551251 * If a factory is not explicitly specified, then a default factory
12561252 * instance is created and returned. The default factory instance is
12571253 * configured to be namespace-aware and to apply reasonable security
1258- * using the {@link XMLReaderUtils#IGNORING_STAX_ENTITY_RESOLVER} .
1254+ * precautions .
12591255 *
12601256 * @return StAX input factory
12611257 */
0 commit comments