Remove multiple implementations of getSshHost() in email classes
The getSshHost() method was implemented in both ReplacePatchSetSender and NewChangeSender. Remove these and implement it in the NotificationEmail base class instead. Change-Id: I55e36021915d147e01c676e7837557f5283812f6
This commit is contained in:
committed by
David Pursehouse
parent
618f878dc0
commit
3a495e6c46
@@ -23,8 +23,6 @@ import com.google.gerrit.server.ssh.SshInfo;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.assistedinject.Assisted;
|
||||
|
||||
import com.jcraft.jsch.HostKey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
@@ -39,14 +37,13 @@ public class ReplacePatchSetSender extends ReplyToChangeSender {
|
||||
|
||||
private final Set<Account.Id> reviewers = new HashSet<Account.Id>();
|
||||
private final Set<Account.Id> extraCC = new HashSet<Account.Id>();
|
||||
private final SshInfo sshInfo;
|
||||
|
||||
@Inject
|
||||
public ReplacePatchSetSender(EmailArguments ea,
|
||||
@AnonymousCowardName String anonymousCowardName, SshInfo si,
|
||||
@Assisted Change c) {
|
||||
super(ea, anonymousCowardName, c, "newpatchset");
|
||||
sshInfo = si;
|
||||
setSshInfo(si);
|
||||
}
|
||||
|
||||
public void addReviewers(final Collection<Account.Id> cc) {
|
||||
@@ -88,17 +85,4 @@ public class ReplacePatchSetSender extends ReplyToChangeSender {
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
public String getSshHost() {
|
||||
final List<HostKey> hostKeys = sshInfo.getHostKeys();
|
||||
if (hostKeys.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final String host = hostKeys.get(0).getHost();
|
||||
if (host.startsWith("*:")) {
|
||||
return getGerritHost() + host.substring(1);
|
||||
}
|
||||
return host;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user