]> source.dussan.org Git - jgit.git/commitdiff
Fix SshSessionFactory#setInstance to use service loader 87/156587/2
authorMatthias Sohn <matthias.sohn@sap.com>
Sun, 26 Jan 2020 19:26:01 +0000 (20:26 +0100)
committerMatthias Sohn <matthias.sohn@sap.com>
Mon, 27 Jan 2020 08:52:51 +0000 (09:52 +0100)
If setInstance(SshSessionFactory) is called with parameter null
set default session factory using the newly introduced service loader
instead of hard-coding the default factory class.

Change-Id: I86b5932333cc53b706534a2822e0fd96e12e6e47
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java

index ad04d424d7e962d65650fad7ea6dd8010cc6b382..e6d204242237a53da0b92f0cff58ae237853b58b 100644 (file)
@@ -63,10 +63,11 @@ public abstract class SshSessionFactory {
         *            default factory will be restored.s
         */
        public static void setInstance(SshSessionFactory newFactory) {
-               if (newFactory != null)
+               if (newFactory != null) {
                        INSTANCE = newFactory;
-               else
-                       INSTANCE = new DefaultSshSessionFactory();
+               } else {
+                       INSTANCE = loadSshSessionFactory();
+               }
        }
 
        /**