]> source.dussan.org Git - gitblit.git/commitdiff
Ensure plugins dir is created before pf4j is instantiated
authorJames Moger <james.moger@gitblit.com>
Fri, 11 Apr 2014 17:40:22 +0000 (13:40 -0400)
committerJames Moger <james.moger@gitblit.com>
Fri, 11 Apr 2014 17:48:14 +0000 (13:48 -0400)
src/main/java/com/gitblit/manager/PluginManager.java

index 9cefc88d4b625548a42fcd85dabebec167916252..1c26fa151d84d7318a589ecbba45cb0856715434 100644 (file)
@@ -80,6 +80,7 @@ public class PluginManager implements IPluginManager, PluginStateListener {
 
        public PluginManager(IRuntimeManager runtimeManager) {
                File dir = runtimeManager.getFileOrFolder(Keys.plugins.folder, "${baseFolder}/plugins");
+               dir.mkdirs();
                this.runtimeManager = runtimeManager;
                this.pf4j = new DefaultPluginManager(dir);
        }
@@ -229,11 +230,11 @@ public class PluginManager implements IPluginManager, PluginStateListener {
        }
 
        @Override
-       public synchronized boolean refreshRegistry() {
+       public synchronized boolean refreshRegistry(boolean verifyChecksum) {
                String dr = "http://gitblit.github.io/gitblit-registry/plugins.json";
                String url = runtimeManager.getSettings().getString(Keys.plugins.registry, dr);
                try {
-                       File file = download(url, true);
+                       File file = download(url, verifyChecksum);
                        if (file != null && file.exists()) {
                                URL selfUrl = new URL(url.substring(0, url.lastIndexOf('/')));
                                // replace ${self} with the registry url
@@ -260,7 +261,7 @@ public class PluginManager implements IPluginManager, PluginStateListener {
                File[] files = folder.listFiles(jsonFilter);
                if (files == null || files.length == 0) {
                        // automatically retrieve the registry if we don't have a local copy
-                       refreshRegistry();
+                       refreshRegistry(true);
                        files = folder.listFiles(jsonFilter);
                }