PatchSetInserter: Remove unused SshInfo member and setter method
There are no callers of the setter method, so the member variable
is never initialized and a "new NoSshInfo" is always passed into
the validator.
Change-Id: I0a79ca95903e8d8c921da292be14918ee755e1c3
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java b/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
index 508d380..e805ad0 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/change/PatchSetInserter.java
@@ -47,7 +47,6 @@
import com.google.gerrit.server.patch.PatchSetInfoFactory;
import com.google.gerrit.server.project.ChangeControl;
import com.google.gerrit.server.ssh.NoSshInfo;
-import com.google.gerrit.server.ssh.SshInfo;
import com.google.gwtorm.server.OrmException;
import com.google.inject.assistedinject.Assisted;
import com.google.inject.assistedinject.AssistedInject;
@@ -91,7 +90,6 @@
private final ChangeControl origCtl;
// Fields exposed as setters.
- private SshInfo sshInfo;
private String message;
private CommitValidators.Policy validatePolicy =
CommitValidators.Policy.GERRIT;
@@ -144,11 +142,6 @@
return this;
}
- public PatchSetInserter setSshInfo(SshInfo sshInfo) {
- this.sshInfo = sshInfo;
- return this;
- }
-
public PatchSetInserter setValidatePolicy(CommitValidators.Policy validate) {
this.validatePolicy = checkNotNull(validate);
return this;
@@ -198,7 +191,6 @@
@Override
public void updateRepo(RepoContext ctx)
throws AuthException, ResourceConflictException, IOException, OrmException {
- init();
validate(ctx);
ctx.addRefUpdate(new ReceiveCommand(ObjectId.zeroId(),
commit, getPatchSetId().toRefName(), ReceiveCommand.Type.CREATE));
@@ -282,17 +274,11 @@
}
}
- private void init() {
- if (sshInfo == null) {
- sshInfo = new NoSshInfo();
- }
- }
-
private void validate(RepoContext ctx)
throws AuthException, ResourceConflictException, IOException,
OrmException {
CommitValidators cv = commitValidatorsFactory.create(
- origCtl.getRefControl(), sshInfo, ctx.getRepository());
+ origCtl.getRefControl(), new NoSshInfo(), ctx.getRepository());
if (!origCtl.canAddPatchSet(ctx.getDb())) {
throw new AuthException("cannot add patch set");