This is an automated email from the ASF dual-hosted git repository. andy pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/jena.git
commit a621223a6e9e0424d6fe861a0553da5b8f0f7cd2 Author: Andy Seaborne <[email protected]> AuthorDate: Fri Apr 25 14:59:32 2025 +0100 GH-3150: Print system initialization errors --- .../main/java/org/apache/jena/sys/JenaSystem.java | 27 ++++++++++++++++------ 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/jena-core/src/main/java/org/apache/jena/sys/JenaSystem.java b/jena-core/src/main/java/org/apache/jena/sys/JenaSystem.java index decd1d236e..fe3fd2d0ed 100644 --- a/jena-core/src/main/java/org/apache/jena/sys/JenaSystem.java +++ b/jena-core/src/main/java/org/apache/jena/sys/JenaSystem.java @@ -96,6 +96,8 @@ public class JenaSystem { static final boolean IS_INITIALIZED = jenaSystemInitialization(); private static boolean jenaSystemInitialization() { + + JenaSystem.initialized = true; // Set early to avoid blocking on static initialization. setup(); if ( DEBUG_INIT ) @@ -107,13 +109,24 @@ public class JenaSystem { } private static void setup() { - // Called inside synchronized - if ( singleton == null ) { - singleton = new Subsystem<>(JenaSubsystemLifecycle.class); - SubsystemRegistry<JenaSubsystemLifecycle> reg = - new SubsystemRegistryServiceLoader<>(JenaSubsystemLifecycle.class); - singleton.setSubsystemRegistry(reg); - reg.add(new JenaInitLevel0()); + try { + if ( singleton == null ) { + singleton = new Subsystem<>(JenaSubsystemLifecycle.class); + SubsystemRegistry<JenaSubsystemLifecycle> reg = + new SubsystemRegistryServiceLoader<>(JenaSubsystemLifecycle.class); + singleton.setSubsystemRegistry(reg); + reg.add(new JenaInitLevel0()); + } + } catch (Throwable th) { + // This really, really should not happen. + System.err.println(">> JenaSystem initialization"); + System.err.println(th.getMessage()); + if ( th.getCause() != null ) + System.err.println(th.getCause().getMessage()); + System.err.println("----"); + th.printStackTrace(); + System.err.println("<< JenaSystem initialization"); + throw th; } }
