Make Gogo shell killer more robust
authorMathieu Baudier <mbaudier@argeo.org>
Tue, 5 Mar 2024 15:16:46 +0000 (16:16 +0100)
committerMathieu Baudier <mbaudier@argeo.org>
Tue, 5 Mar 2024 15:16:46 +0000 (16:16 +0100)
org.argeo.cms/src/org/argeo/cms/internal/osgi/GogoShellKiller.java

index 9de7a4fd13f081497909bc6c08041e321a433400..332f5cb8c0b72d2cf68eba0d4520893276c05220 100644 (file)
@@ -30,7 +30,7 @@ class GogoShellKiller extends Thread {
                        return;
                System.exit(0);
                // No non-deamon threads left, forcibly halting the VM
-               //Runtime.getRuntime().halt(0);
+               // Runtime.getRuntime().halt(0);
        }
 
        private ThreadGroup getRootThreadGroup(ThreadGroup tg) {
@@ -56,7 +56,7 @@ class GogoShellKiller extends Thread {
                Thread[] threads = new Thread[rootThreadGroup.activeCount()];
                rootThreadGroup.enumerate(threads, true);
                for (Thread thread : threads) {
-                       if (thread.getName().equals("pipe-gosh --login --noshutdown"))
+                       if (thread.getName() != null && thread.getName().equals("pipe-gosh --login --noshutdown"))
                                return thread;
                }
                return null;