From: Matthias Sohn Date: Sun, 26 Jan 2020 19:26:01 +0000 (+0100) Subject: Fix SshSessionFactory#setInstance to use service loader X-Git-Tag: v5.7.0.202002241735-m3~3^2~15 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7a23fc1250765eb455d71ddd012fc9fbb1e64b65;p=jgit.git Fix SshSessionFactory#setInstance to use service loader 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 --- diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java index ad04d424d7..e6d2042422 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java @@ -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(); + } } /**