justinmclean opened a new issue, #10164:
URL: https://github.com/apache/gravitino/issues/10164
### What would you like to be improved?
SchemaOperations#createSchema logs request.getName() before entering its
try/catch.
If request is null (for example, empty/missing POST body), this causes an
immediate NullPointerException outside the error-handling path. Result:
inconsistent 500 behavior.
### How should we improve?
Move all request field access behind a null-safe check inside the try path,
and fail fast with a controlled validation error when request == null (for
example, treat as bad request).
Also, make the catch path null-safe (don’t call request.getName() unless
request is non-null).
Add/keep a unit test for null request input to ensure the endpoint never
throws uncaught exceptions.
Here's a unit test to help:
```
@Test
public void testCreateSchemaWithNullRequestShouldNotThrow() {
SchemaOperations operations = new SchemaOperations(dispatcher);
Assertions.assertDoesNotThrow(() -> operations.createSchema(metalake,
catalog, null));
}
```
--
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]