mirror of https://github.com/apache/kafka.git
MINOR: make sure all fiedls of o.p.k.s.a.Action are NOT null (#10764)
I'm migrating Ranger's kafka plugin from deprecated Authorizer (this is already removed by 976e78e) to new API (see https://issues.apache.org/jira/browse/RANGER-3231). The kafka plugin needs to take something from field resourcePattern but it does not know whether the field is nullable (or users need to add null check). I check all usages and I don't observe any null case.
Reviewers: Ismael Juma <ismael@juma.me.uk>
This commit is contained in:
parent
5cbe6a7b09
commit
a6f30945fa
|
|
@ -31,27 +31,32 @@ public class Action {
|
|||
private final boolean logIfAllowed;
|
||||
private final boolean logIfDenied;
|
||||
|
||||
/**
|
||||
* @param operation non-null operation being performed
|
||||
* @param resourcePattern non-null resource pattern on which this action is being performed
|
||||
*/
|
||||
public Action(AclOperation operation,
|
||||
ResourcePattern resourcePattern,
|
||||
int resourceReferenceCount,
|
||||
boolean logIfAllowed,
|
||||
boolean logIfDenied) {
|
||||
this.operation = operation;
|
||||
this.resourcePattern = resourcePattern;
|
||||
this.operation = Objects.requireNonNull(operation, "operation can't be null");
|
||||
this.resourcePattern = Objects.requireNonNull(resourcePattern, "resourcePattern can't be null");
|
||||
this.logIfAllowed = logIfAllowed;
|
||||
this.logIfDenied = logIfDenied;
|
||||
this.resourceReferenceCount = resourceReferenceCount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Resource on which action is being performed.
|
||||
* @return a non-null resource pattern on which this action is being performed
|
||||
*/
|
||||
public ResourcePattern resourcePattern() {
|
||||
return resourcePattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Operation being performed.
|
||||
*
|
||||
* @return a non-null operation being performed
|
||||
*/
|
||||
public AclOperation operation() {
|
||||
return operation;
|
||||
|
|
|
|||
Loading…
Reference in New Issue