This is an automated email from the ASF dual-hosted git repository.
jshao pushed a commit to branch branch-1.0
in repository https://gitbox.apache.org/repos/asf/gravitino.git
The following commit(s) were added to refs/heads/branch-1.0 by this push:
new 25667b768d [#8731] fix(policy): PolicyUpdateRequest.validate checks
for null policyType (#8745)
25667b768d is described below
commit 25667b768d3e89c9574210c97a9657f222ddd8c3
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Oct 9 11:27:00 2025 +0800
[#8731] fix(policy): PolicyUpdateRequest.validate checks for null
policyType (#8745)
**Description:**
This Pull Request implements the improvement requested in issue #8731.
**The change:**
A validation check has been added to the **`validate()`** method of the
inner class **`UpdatePolicyContentRequest`** (found in
`PolicyUpdateRequest.java`) to ensure that the **`policyType` field is
not null**.
The check uses `Preconditions.checkArgument(policyType != null,
"\"policyType\" must not be null")` to align with the existing
validation patterns in the class.
**Closes Issue:** Fixes #8731
Co-authored-by: Hugo Pexegueiro Salazar
<[email protected]>
Co-authored-by: RealHugoPS <[email protected]>
---
.../main/java/org/apache/gravitino/dto/requests/PolicyUpdateRequest.java | 1 +
1 file changed, 1 insertion(+)
diff --git
a/common/src/main/java/org/apache/gravitino/dto/requests/PolicyUpdateRequest.java
b/common/src/main/java/org/apache/gravitino/dto/requests/PolicyUpdateRequest.java
index f33236e84f..035ff10490 100644
---
a/common/src/main/java/org/apache/gravitino/dto/requests/PolicyUpdateRequest.java
+++
b/common/src/main/java/org/apache/gravitino/dto/requests/PolicyUpdateRequest.java
@@ -167,6 +167,7 @@ public interface PolicyUpdateRequest extends RESTRequest {
@Override
public void validate() throws IllegalArgumentException {
+ Preconditions.checkArgument(policyType != null, "\"policyType\" must not
be null");
Preconditions.checkArgument(newContent != null, "\"newContent\" must not
be null");
newContent.validate();
}