summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn <matthias.sohn@sap.com>2020-01-26 20:26:01 +0100
committerMatthias Sohn <matthias.sohn@sap.com>2020-01-27 09:52:51 +0100
commit7a23fc1250765eb455d71ddd012fc9fbb1e64b65 (patch)
treed511177ea1ae131b086b26b3bd81eeab7f2e09bc
parent54b1c7cc6a2ba6031b97d8a5c455d93ffd4ce5f5 (diff)
downloadjgit-7a23fc1250765eb455d71ddd012fc9fbb1e64b65.tar.gz
jgit-7a23fc1250765eb455d71ddd012fc9fbb1e64b65.zip
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 <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/transport/SshSessionFactory.java7
1 files changed, 4 insertions, 3 deletions
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();
+ }
}
/**