]> source.dussan.org Git - gitblit.git/commitdiff
Fix NullpointerException when stopping GitBlit Server.
authorFlorian Zschocke <florian.zschocke@devolo.de>
Thu, 7 Nov 2019 22:35:06 +0000 (23:35 +0100)
committerFlorian Zschocke <florian.zschocke@devolo.de>
Thu, 7 Nov 2019 22:45:59 +0000 (23:45 +0100)
When GitBlit server did not start properly, is running but couldn't
start the `PluginManager`, then stopping the server via the `--stop`
argument on the command line resulted in a NullpointerException.
Which left the server running. Now this is prevented and the server
will actually shut down.

src/main/java/com/gitblit/servlet/GitblitContext.java

index 750da796f33c1398a2d10acf047bcd93eb0da3fb..cd8615a8ab80ab8556b846f2346f36d07a1ac5e7 100644 (file)
@@ -293,11 +293,13 @@ public class GitblitContext extends GuiceServletContextListener {
                logger.info("Gitblit context destroyed by servlet container.");
 
                IPluginManager pluginManager = getManager(IPluginManager.class);
-               for (LifeCycleListener listener : pluginManager.getExtensions(LifeCycleListener.class)) {
-                       try {
-                               listener.onShutdown();
-                       } catch (Throwable t) {
-                               logger.error(null, t);
+               if (pluginManager != null) {
+                       for (LifeCycleListener listener : pluginManager.getExtensions(LifeCycleListener.class)) {
+                               try {
+                                       listener.onShutdown();
+                               } catch (Throwable t) {
+                                       logger.error(null, t);
+                               }
                        }
                }