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 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.conditions.BooleanCondition;
|
||||||
import com.google.gerrit.extensions.restapi.AuthException;
|
import com.google.gerrit.extensions.restapi.AuthException;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||||
@ -59,7 +60,7 @@ public class DeletePrivate
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Response<String> applyImpl(
|
protected Response<String> applyImpl(
|
||||||
BatchUpdate.Factory updateFactory, ChangeResource rsrc, SetPrivateOp.Input input)
|
BatchUpdate.Factory updateFactory, ChangeResource rsrc, @Nullable SetPrivateOp.Input input)
|
||||||
throws RestApiException, UpdateException {
|
throws RestApiException, UpdateException {
|
||||||
if (!canDeletePrivate(rsrc).value()) {
|
if (!canDeletePrivate(rsrc).value()) {
|
||||||
throw new AuthException("not allowed to unmark private");
|
throw new AuthException("not allowed to unmark private");
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
package com.google.gerrit.server.restapi.change;
|
package com.google.gerrit.server.restapi.change;
|
||||||
|
|
||||||
import com.google.common.base.Strings;
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.gerrit.common.Nullable;
|
||||||
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
import com.google.gerrit.extensions.restapi.ResourceConflictException;
|
||||||
import com.google.gerrit.reviewdb.client.Change;
|
import com.google.gerrit.reviewdb.client.Change;
|
||||||
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
import com.google.gerrit.reviewdb.client.ChangeMessage;
|
||||||
@ -43,14 +44,14 @@ public class SetPrivateOp implements BatchUpdateOp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface Factory {
|
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 PrivateStateChanged privateStateChanged;
|
||||||
|
private final PatchSetUtil psUtil;
|
||||||
|
private final ChangeMessagesUtil cmUtil;
|
||||||
|
private final boolean isPrivate;
|
||||||
|
@Nullable private final Input input;
|
||||||
|
|
||||||
private Change change;
|
private Change change;
|
||||||
private PatchSet ps;
|
private PatchSet ps;
|
||||||
@ -61,12 +62,12 @@ public class SetPrivateOp implements BatchUpdateOp {
|
|||||||
PatchSetUtil psUtil,
|
PatchSetUtil psUtil,
|
||||||
@Assisted ChangeMessagesUtil cmUtil,
|
@Assisted ChangeMessagesUtil cmUtil,
|
||||||
@Assisted boolean isPrivate,
|
@Assisted boolean isPrivate,
|
||||||
@Assisted Input input) {
|
@Assisted @Nullable Input input) {
|
||||||
this.cmUtil = cmUtil;
|
this.privateStateChanged = privateStateChanged;
|
||||||
this.psUtil = psUtil;
|
this.psUtil = psUtil;
|
||||||
|
this.cmUtil = cmUtil;
|
||||||
this.isPrivate = isPrivate;
|
this.isPrivate = isPrivate;
|
||||||
this.input = input;
|
this.input = input;
|
||||||
this.privateStateChanged = privateStateChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user