aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.ssh.apache
diff options
context:
space:
mode:
authorJonathan Nieder <jrn@google.com>2023-09-11 17:12:17 -0700
committerJonathan Nieder <jrn@google.com>2023-09-11 17:12:17 -0700
commit3bc1da30dfb11a2cdfc0efb5bcc62af09be9cfd9 (patch)
tree162b2267d19af15126f672caca40c36933598fa1 /org.eclipse.jgit.ssh.apache
parent82c6638c72cd9525bab94b02438c167747132be9 (diff)
downloadjgit-3bc1da30dfb11a2cdfc0efb5bcc62af09be9cfd9.tar.gz
jgit-3bc1da30dfb11a2cdfc0efb5bcc62af09be9cfd9.zip
ssh: Remove redundant null check for home.getAbsoluteFile()
File#getAbsoluteFile is non-nullable, so this check can never trigger. Worse, getAbsoluteFile can throw an exception such as InvalidPathException, and since this call isn't in the "try" block that checks for that, the exception would then escape the getSession call. Noticed because the exception is being thrown in googlesource.com's custom SshdSessionFactory, causing incoming ssh requests to fail (noticed using internal tests). Change-Id: I57f2d5e497ff678b17573f79827b6e1d9a6c9b9f Signed-off-by: Jonathan Nieder <jrn@google.com>
Diffstat (limited to 'org.eclipse.jgit.ssh.apache')
-rw-r--r--org.eclipse.jgit.ssh.apache/src/org/eclipse/jgit/transport/sshd/SshdSessionFactory.java2
1 files changed, 1 insertions, 1 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 cb2549e900..2c3cbe55c9 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,7 +244,7 @@ public class SshdSessionFactory extends SshSessionFactory implements Closeable {
JGitSshClient.PREFERRED_AUTHENTICATIONS,
defaultAuths);
}
- if (home != null && home.getAbsoluteFile() != null) {
+ if (home != null) {
try {
jgitClient.setAttribute(JGitSshClient.HOME_DIRECTORY,
home.getAbsoluteFile().toPath());