From 8f206e7fe4575db85286f17546675187ce4377e0 Mon Sep 17 00:00:00 2001 From: Elliotte Rusty Harold Date: Tue, 1 Sep 2026 08:56:02 -0400 Subject: [PATCH] Remove unthrown exceptions --- .../commons/xml/secure/FallbackIgnoreEntityResolver2.java | 4 ++-- .../commons/xml/secure/SecureTransformerFactoryTest.java | 2 +- src/test/java/org/apache/commons/xml/secure/XIncludeTest.java | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/apache/commons/xml/secure/FallbackIgnoreEntityResolver2.java b/src/main/java/org/apache/commons/xml/secure/FallbackIgnoreEntityResolver2.java index d2322e80..55d605a1 100644 --- a/src/main/java/org/apache/commons/xml/secure/FallbackIgnoreEntityResolver2.java +++ b/src/main/java/org/apache/commons/xml/secure/FallbackIgnoreEntityResolver2.java @@ -109,11 +109,11 @@ public InputSource getExternalSubset(final String name, final String baseURI) th * @param publicId The public identifier, or {@code null} if none. * @param baseURI The base URI for relative resolution, or {@code null}. * @param systemId The system identifier of the unresolved entity. - * @return An empty {@link InputSource} carrying the requested identifiers. + * @return an empty {@link InputSource} carrying the requested identifiers. * @throws SAXException when {@value SecureException#THROW_ON_UNRESOLVED} is set: unresolved references are rejected instead of resolved to empty. * @throws IOException never by the default implementation. */ - protected InputSource onUnresolved(final String name, final String publicId, final String baseURI, final String systemId) throws SAXException, IOException { + protected InputSource onUnresolved(final String name, final String publicId, final String baseURI, final String systemId) throws SAXException { if (SecureException.throwOnUnresolved()) { throw new SAXException(SecureException.forbidden(name, null, publicId, systemId, baseURI)); } diff --git a/src/test/java/org/apache/commons/xml/secure/SecureTransformerFactoryTest.java b/src/test/java/org/apache/commons/xml/secure/SecureTransformerFactoryTest.java index 1e5fbf02..1c309b80 100644 --- a/src/test/java/org/apache/commons/xml/secure/SecureTransformerFactoryTest.java +++ b/src/test/java/org/apache/commons/xml/secure/SecureTransformerFactoryTest.java @@ -157,7 +157,7 @@ public void setFeature(final String name, final boolean value) throws Transforme } } - private static void associatedStylesheet(final SAXTransformerFactory factory, final Source source) throws Exception { + private static void associatedStylesheet(final SAXTransformerFactory factory, final Source source) { try { factory.getAssociatedStylesheet(source, null, null, null); } catch (final TransformerConfigurationException | NullPointerException expected) { diff --git a/src/test/java/org/apache/commons/xml/secure/XIncludeTest.java b/src/test/java/org/apache/commons/xml/secure/XIncludeTest.java index fc8aee01..3426bef6 100644 --- a/src/test/java/org/apache/commons/xml/secure/XIncludeTest.java +++ b/src/test/java/org/apache/commons/xml/secure/XIncludeTest.java @@ -192,7 +192,7 @@ void secureDomBlocksParseText() throws Exception { @Test @Tag("dom") - void secureDomBlocksParseXml() throws Exception { + void secureDomBlocksParseXml() { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final DocumentBuilderFactory factory = SecureDocumentBuilderFactory.newInstance(); @@ -306,7 +306,7 @@ void secureSaxBlocksParseText() throws Exception { @Test @Tag("sax") - void secureSaxBlocksParseXml() throws Exception { + void secureSaxBlocksParseXml() { final InputSource input = inputSource(xiIncludeXml(REFERENCED_XML, "xml")); final SAXParserFactory factory = SecureSAXParserFactory.newInstance();