Browse Source

Fix NPE in TransportGitSsh.ExtSession.exec()

Bug: 527383
Change-Id: I965860b4e0e9aa1adf6a1bb0735940cbd22adced
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
stable-4.9
Matthias Sohn 7 years ago committed by David Pursehouse
parent
commit
29c5f49f63
  1. 20
      org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java

20
org.eclipse.jgit/src/org/eclipse/jgit/transport/TransportGitSsh.java

@ -242,14 +242,7 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
args.add(getURI().getHost());
args.add(command);
ProcessBuilder pb = new ProcessBuilder();
pb.command(args);
File directory = local.getDirectory();
if (directory != null)
pb.environment().put(Constants.GIT_DIR_KEY,
directory.getPath());
ProcessBuilder pb = createProcess(args);
try {
return pb.start();
} catch (IOException err) {
@ -257,6 +250,17 @@ public class TransportGitSsh extends SshTransport implements PackTransport {
}
}
private ProcessBuilder createProcess(List<String> args) {
ProcessBuilder pb = new ProcessBuilder();
pb.command(args);
File directory = local != null ? local.getDirectory() : null;
if (directory != null) {
pb.environment().put(Constants.GIT_DIR_KEY,
directory.getPath());
}
return pb;
}
@Override
public void disconnect() {
// Nothing to do

Loading…
Cancel
Save