From ba1653162c4dba3a25a600bef642dc5459ce01ee Mon Sep 17 00:00:00 2001 From: Minh Thai Date: Wed, 6 Sep 2023 07:13:05 -0700 Subject: [PATCH] Ensure home directory not null before using in Sshdsessionfactory Home directory might not be set in DFS. Change-Id: I3528685838065dc291826fc73a37126af7bf47ce --- .../jgit/transport/sshd/SshdSessionFactory.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java index 35c9be047a..cb2549e900 100644 --- a/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java +++ b/org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java @@ -244,11 +244,13 @@ public class SshdSessionFactory extends SshSessionFactory implements Closeable { JGitSshClient.PREFERRED_AUTHENTICATIONS, defaultAuths); } - try { - jgitClient.setAttribute(JGitSshClient.HOME_DIRECTORY, - home.getAbsoluteFile().toPath()); - } catch (SecurityException | InvalidPathException e) { + if (home != null && home.getAbsoluteFile() != null) { + try { + jgitClient.setAttribute(JGitSshClient.HOME_DIRECTORY, + home.getAbsoluteFile().toPath()); + } catch (SecurityException | InvalidPathException e) { // Ignore + } } // Other things? return client; -- 2.39.5