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
The following commit(s) were added to refs/heads/main by this push:
new 987e622 Redo of Refactor: surface static-init failures as
ExceptionInInitializerError- #51
987e622 is described below
commit 987e622f2bd05164f835608b5dcda1b23a77f0d1
Author: Gary Gregory <[email protected]>
AuthorDate: Wed Aug 26 13:01:24 2026 -0400
Redo of Refactor: surface static-init failures as
ExceptionInInitializerError- #51
---
.../java/org/apache/commons/xml/FallbackIgnoreURIResolver.java | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git
a/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
b/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
index debd391..7e34f46 100644
--- a/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
+++ b/src/main/java/org/apache/commons/xml/FallbackIgnoreURIResolver.java
@@ -56,21 +56,25 @@ final class FallbackIgnoreURIResolver implements
URIResolver {
*
* @see #newEmptyDocument()
*/
- private static final Document EMPTY_DOCUMENT = newEmptyDocument();
+ private static final Document EMPTY_DOCUMENT;
+
+ static {
+ EMPTY_DOCUMENT = newEmptyDocument();
+ }
/**
* Creates a new empty document.
*
* @return a new empty document.
* @throws HardeningException Thrown if a {@link DocumentBuilder}
cannot be created which satisfies the configuration requested.
- * @throws FactoryConfigurationError Thrown from a factory in case of a
{@link java.util.ServiceConfigurationError service
+ * @throws ExceptionInInitializerError Thrown from a factory in case of a
{@link java.util.ServiceConfigurationError service
* configuration error} or if the
implementation is not available or cannot be instantiated.
*/
private static Document newEmptyDocument() {
try {
return
DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
} catch (final ParserConfigurationException e) {
- throw new HardeningException("A DocumentBuilder cannot be created
which satisfies the configuration requested.", e);
+ throw new ExceptionInInitializerError(e);
}
}