Mark DeletePrivate input as @Nullable
The documentation says that an input is not required. The code checks for null values correctly, but the injection methods lack @Nullable which makes Guice fail to create the object when null is passed to the factory method. Annotate the input object as @Nullable to fix this. Change-Id: I0d424e45d6039fd4ad8386b6811b9134cd600dfd
This commit is contained in:
parent
e3efc1f715
commit
f843d8674e
@ -16,6 +16,7 @@ package com.google.gerrit.server.restapi.change;
|
||||
|
||||
import static com.google.gerrit.extensions.conditions.BooleanCondition.or;
|
||||
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.extensions.conditions.BooleanCondition;
|
||||
import com.google.gerrit.extensions.restapi.AuthException;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
@ -59,7 +60,7 @@ public class DeletePrivate
|
||||
|
||||
@Override
|
||||
protected Response<String> applyImpl(
|
||||
BatchUpdate.Factory updateFactory, ChangeResource rsrc, SetPrivateOp.Input input)
|
||||
BatchUpdate.Factory updateFactory, ChangeResource rsrc, @Nullable SetPrivateOp.Input input)
|
||||
throws RestApiException, UpdateException {
|
||||
if (!canDeletePrivate(rsrc).value()) {
|
||||
throw new AuthException("not allowed to unmark private");
|
||||
|
@ -15,6 +15,7 @@
|
||||
package com.google.gerrit.server.restapi.change;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.gerrit.common.Nullable;
|
||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||
import com.google.gerrit.reviewdb.client.Change;
|
||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||
@ -43,14 +44,14 @@ public class SetPrivateOp implements BatchUpdateOp {
|
||||
}
|
||||
|
||||
public interface Factory {
|
||||
SetPrivateOp create(ChangeMessagesUtil cmUtil, boolean isPrivate, Input input);
|
||||
SetPrivateOp create(ChangeMessagesUtil cmUtil, boolean isPrivate, @Nullable Input input);
|
||||
}
|
||||
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final PatchSetUtil psUtil;
|
||||
private final boolean isPrivate;
|
||||
private final Input input;
|
||||
private final PrivateStateChanged privateStateChanged;
|
||||
private final PatchSetUtil psUtil;
|
||||
private final ChangeMessagesUtil cmUtil;
|
||||
private final boolean isPrivate;
|
||||
@Nullable private final Input input;
|
||||
|
||||
private Change change;
|
||||
private PatchSet ps;
|
||||
@ -61,12 +62,12 @@ public class SetPrivateOp implements BatchUpdateOp {
|
||||
PatchSetUtil psUtil,
|
||||
@Assisted ChangeMessagesUtil cmUtil,
|
||||
@Assisted boolean isPrivate,
|
||||
@Assisted Input input) {
|
||||
this.cmUtil = cmUtil;
|
||||
@Assisted @Nullable Input input) {
|
||||
this.privateStateChanged = privateStateChanged;
|
||||
this.psUtil = psUtil;
|
||||
this.cmUtil = cmUtil;
|
||||
this.isPrivate = isPrivate;
|
||||
this.input = input;
|
||||
this.privateStateChanged = privateStateChanged;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user