This is an automated email from the ASF dual-hosted git repository.

jmclean pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/main by this push:
     new e195feea68 [#9095] fix(dto): Ensure index field names are not null 
(#9118)
e195feea68 is described below

commit e195feea685988afbb3746f03bbb343bc073c033
Author: Kwon Taeheon <[email protected]>
AuthorDate: Sun Nov 16 17:14:15 2025 +0900

    [#9095] fix(dto): Ensure index field names are not null (#9118)
    
    ### What changes were proposed in this pull request?
    
    - I fixed a piece of code in TableCreateRequest.validate that could
    potentially cause a NPE.
    
    ### Why are the changes needed?
    
    - Added null check for updates list in request validation.
    
    Fix: #9095
    
    ### Does this PR introduce _any_ user-facing change?
    
    - no.
    - This change only corrects internal exception handling logic, with no
    modification to public APIs or user-visible behavior.
    
    ### How was this patch tested?
    
    - No new tests added, since this only fixes the caught exception type.
    - Ensured all existing tests continue to pass.
---
 .../java/org/apache/gravitino/dto/requests/TableCreateRequest.java   | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git 
a/common/src/main/java/org/apache/gravitino/dto/requests/TableCreateRequest.java
 
b/common/src/main/java/org/apache/gravitino/dto/requests/TableCreateRequest.java
index d6d22ddb9f..965de27c17 100644
--- 
a/common/src/main/java/org/apache/gravitino/dto/requests/TableCreateRequest.java
+++ 
b/common/src/main/java/org/apache/gravitino/dto/requests/TableCreateRequest.java
@@ -161,7 +161,10 @@ public class TableCreateRequest implements RESTRequest {
               index -> {
                 Preconditions.checkArgument(index.type() != null, "Index type 
cannot be null");
                 Preconditions.checkArgument(
-                    index.fieldNames().length > 0, "Index field names cannot 
be null");
+                    index.fieldNames() != null, "Index fieldNames cannot be 
null");
+                Preconditions.checkArgument(
+                    index.fieldNames().length > 0,
+                    "Index fieldNames length must be greater than 0");
               });
     }
   }

Reply via email to