rameshreddy-adutla opened a new pull request, #10214:
URL: https://github.com/apache/gravitino/pull/10214

   ### What changes were proposed in this pull request?
   
   Make `SchemaOperations#createSchema` null-safe when the request body is null 
or missing.
   
   ### Why are the changes needed?
   
   `SchemaOperations#createSchema` dereferences `request.getName()` in two 
places outside null-safe paths:
   1. **Line 125** (LOG statement): Before the try/catch — immediate NPE that 
escapes error handling entirely
   2. **Line 142** (catch block): When handling other exceptions — secondary 
NPE masks the original error
   
   Both result in an uncaught `NullPointerException` and inconsistent 500 
behavior.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. API contracts are unchanged. The endpoint now returns a proper error 
response instead of an unhandled NPE when the request body is null.
   
   ### How was this patch tested?
   
   Added unit test `testCreateSchemaWithNullRequestShouldNotThrow` (as 
suggested in #10164) that:
   1. POSTs `"null"` as the request body
   2. Asserts 500 response (not an uncaught NPE)
   3. Asserts the error type is NOT `NullPointerException`
   
   Closes #10164


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to