ppkarwasz commented on code in PR #766:
URL: https://github.com/apache/commons-text/pull/766#discussion_r3965880979


##########
src/test/java/org/apache/commons/text/lookup/XmlStringLookupTest.java:
##########
@@ -64,25 +75,27 @@ void testBadXPath() {
 
     @Test
     void testExternalEntityOff() {
-        assertThrows(IllegalArgumentException.class,
-                () -> new 
XmlStringLookup(XmlStringLookup.DEFAULT_XML_FEATURES, EMPTY_MAP).apply(DOC_DIR 
+ "document-entity-ref.xml:/document/content"));
+        assertDoesNotLeak(
+                () -> new XmlStringLookup(EMPTY_MAP, EMPTY_MAP).apply(DOC_DIR 
+ "document-entity-ref.xml:/document/content"), DATA);
     }
 
     @Test
+    @Disabled("External entities are blocked by Commons Secure XML through an 
entity resolver and can no longer be re-enabled.")
     void testExternalEntityOn() {
         final String key = DOC_DIR + 
"document-entity-ref.xml:/document/content";
         assertEquals(DATA, new XmlStringLookup(EMPTY_MAP, 
EMPTY_MAP).apply(key).trim());
-        assertEquals(DATA, new XmlStringLookup(EMPTY_MAP, 
XmlStringLookup.DEFAULT_XPATH_FEATURES).apply(key).trim());
     }
 
     @Test
     void testInterpolatorExternalDtdOff() {
         final StringSubstitutor stringSubstitutor = 
StringSubstitutor.createInterpolator();
-        assertThrows(IllegalArgumentException.class, () -> 
stringSubstitutor.replace("${xml:" + DOC_DIR + 
"document-external-dtd.xml:/document/content}"));
+        assertDoesNotLeak(() -> stringSubstitutor.replace("${xml:" + DOC_DIR + 
"document-external-dtd.xml:/document/content}"),
+                "This is an external entity.");
     }
 
     @Test
     @SetSystemProperty(key = "javax.xml.accessExternalDTD", value = "file")
+    @Disabled("External entities are blocked by Commons Secure XML through an 
entity resolver and can no longer be re-enabled.")

Review Comment:
   From the comment I can not see the test name any more, but 
`javax.xml.accessExternalDTD`-based tests were removed in 
https://github.com/apache/commons-text/pull/766/commits/3014afc4b625a44e845d10e6dd154ec37ae830a5.
   
   There were three kinds of tests:
   
   1. An external resource (e.g. DTD) is blocked by default.
   2. You can override that with `javax.xml.accessExternalDTD`.
   3. An external resource is allowed if FSP is turned off.
   
   Now the second test case is impossible (no Java system property override), 
while the third kind doesn't use FSP, but a fence.



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

Reply via email to