This is an automated email from the ASF dual-hosted git repository. garydgregory pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/commons-xml.git
commit e594b339049408e29a30a96e1d0c9970de1f5e98 Author: Gary Gregory <[email protected]> AuthorDate: Fri Aug 28 13:41:37 2026 -0400 Rename test method. --- .../apache/commons/xml/EntityResolverFloorTest.java | 4 ++-- .../commons/xml/HardeningFactoriesSmokeTest.java | 20 ++++++++++---------- .../java/org/apache/commons/xml/XIncludeTest.java | 8 -------- 3 files changed, 12 insertions(+), 20 deletions(-) diff --git a/src/test/java/org/apache/commons/xml/EntityResolverFloorTest.java b/src/test/java/org/apache/commons/xml/EntityResolverFloorTest.java index 3452bcd..b56f17c 100644 --- a/src/test/java/org/apache/commons/xml/EntityResolverFloorTest.java +++ b/src/test/java/org/apache/commons/xml/EntityResolverFloorTest.java @@ -366,7 +366,7 @@ void transformerDoesNotLeakUnlisted() { @Test @Tag("trax") - void transformerParsesOptedInDocumentHardened() { + void transformerParsesOptedInDocumentSecured() { // Same contract on the runtime document() channel, which reaches a different internal reader than the compile-time import. final TransformerFactory factory = hardenedTransformerFactory(); factory.setURIResolver((href, base) -> @@ -380,7 +380,7 @@ void transformerParsesOptedInDocumentHardened() { @Test @Tag("trax") - void transformerParsesOptedInImportHardened() { + void transformerParsesOptedInImportSecured() { // The opted-in module carries an external DTD reference; parsed on the floor the DTD is empty, so its entity cannot expand into the output. final TransformerFactory factory = hardenedTransformerFactory(); factory.setURIResolver((href, base) -> diff --git a/src/test/java/org/apache/commons/xml/HardeningFactoriesSmokeTest.java b/src/test/java/org/apache/commons/xml/HardeningFactoriesSmokeTest.java index ca7a800..8b6fa4d 100644 --- a/src/test/java/org/apache/commons/xml/HardeningFactoriesSmokeTest.java +++ b/src/test/java/org/apache/commons/xml/HardeningFactoriesSmokeTest.java @@ -139,35 +139,35 @@ void newXPathFactoryReturnsFreshInstance() throws Exception { // The explicit-class-name tests discover the runtime default implementation through the raw JAXP factory, // so they stay portable across the JAXP implementations of the surefire matrix. @Test - void explicitClassNameDocumentBuilderFactoryIsHardened() throws Exception { + void explicitClassNameDocumentBuilderFactoryIsSecure() throws Exception { final Class<?> impl = DocumentBuilderFactory.newInstance().getClass(); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(impl.getName(), impl.getClassLoader()); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } @Test - void explicitClassNameSAXParserFactoryIsHardened() throws Exception { + void explicitClassNameSAXParserFactoryIsSecure() throws Exception { final Class<?> impl = SAXParserFactory.newInstance().getClass(); final SAXParserFactory factory = SecureSAXParserFactory.newInstance(impl.getName(), impl.getClassLoader()); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } @Test - void explicitClassNameSchemaFactoryIsHardened() throws Exception { + void explicitClassNameSchemaFactoryIsSecure() throws Exception { final Class<?> impl = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).getClass(); final SchemaFactory factory = SecureSchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI, impl.getName(), impl.getClassLoader()); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } @Test - void explicitClassNameTransformerFactoryIsHardened() { + void explicitClassNameTransformerFactoryIsSecure() { final Class<?> impl = TransformerFactory.newInstance().getClass(); final TransformerFactory factory = SecureTransformerFactory.newInstance(impl.getName(), impl.getClassLoader()); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } @Test - void explicitClassNameXPathFactoryIsHardened() throws Exception { + void explicitClassNameXPathFactoryIsSecure() throws Exception { final Class<?> impl = XPathFactory.newInstance().getClass(); final XPathFactory factory = SecureXPathFactory.newInstance(XPathFactory.DEFAULT_OBJECT_MODEL_URI, impl.getName(), impl.getClassLoader()); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); @@ -182,7 +182,7 @@ void newFactoryReturnsFreshInstance() { } @Test - void factoryIdXMLInputFactoryIsHardened() { + void factoryIdXMLInputFactoryIsSecure() { final String factoryId = "org.apache.commons.xml.test.staxFactory"; // XMLInputFactory.newInstance, not newFactory: Android's StAX API predates newFactory, and this file also compiles against android.jar. System.setProperty(factoryId, XMLInputFactory.newInstance().getClass().getName()); @@ -291,25 +291,25 @@ void explicitClassNameNSSAXParserFactoryIsNamespaceAware() throws Exception { } @Test - void newDefaultInstanceSchemaFactoryIsHardened() throws Exception { + void newDefaultInstanceSchemaFactoryIsSecure() throws Exception { final SchemaFactory factory = SecureSchemaFactory.newDefaultInstance(); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } @Test - void newDefaultInstanceTransformerFactoryIsHardened() { + void newDefaultInstanceTransformerFactoryIsSecure() { final TransformerFactory factory = SecureTransformerFactory.newDefaultInstance(); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } @Test - void newDefaultFactoryXMLInputFactoryIsHardened() { + void newDefaultFactoryXMLInputFactoryIsSecure() { final XMLInputFactory factory = SecureXMLInputFactory.newDefaultFactory(); assertEquals(Boolean.TRUE, factory.getProperty(XMLInputFactory.SUPPORT_DTD)); } @Test - void newDefaultInstanceXPathFactoryIsHardened() throws Exception { + void newDefaultInstanceXPathFactoryIsSecure() throws Exception { final XPathFactory factory = SecureXPathFactory.newDefaultInstance(); assertTrue(factory.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING)); } diff --git a/src/test/java/org/apache/commons/xml/XIncludeTest.java b/src/test/java/org/apache/commons/xml/XIncludeTest.java index 6982848..bcbf6dd 100644 --- a/src/test/java/org/apache/commons/xml/XIncludeTest.java +++ b/src/test/java/org/apache/commons/xml/XIncludeTest.java @@ -178,10 +178,6 @@ void baselineSaxLeaksParseXml() throws Exception { "Baseline SAX parse=xml should leak marker; got: " + captured); } - //endregion - - //region Hardened factory: the include is never fetched - @Test @Tag("dom") void hardenedDomBlocksParseText() throws Exception { @@ -239,10 +235,6 @@ void hardenedDomWithAllowListResolvesParseText() throws Exception { "DOM parse=text with allow-list should resolve to the resolver's content"); } - //endregion - - //region Hardened factory + allow-list resolver: allowed href works, non-allowed throws - @Test @Tag("dom") void hardenedDomWithAllowListResolvesParseXml() throws Exception {
