mchades opened a new issue, #12769:
URL: https://github.com/apache/gravitino/issues/12769
### Describe what's wrong
`POST /api/metalakes/{metalake}/catalogs/{catalog}/schemas/{schema}/views`
returns HTTP 500 with an empty response body when the request body is empty
or
deserializes to `null`.
`ViewOperations.createView` calls `request.getName()` before checking whether
`request` is null. The resulting `NullPointerException` bypasses the
structured
REST error response path.
An empty request body is a client error and should return a structured HTTP
400
response.
### Error message and/or stacktrace
Observed response:
```http
HTTP/1.1 500 Internal Server Error
Content-Length: 0
```
The handler dereferences `request` in the pre-try log statement and again in
the
catch path.
### How to reproduce
Use the main branch and start a Gravitino server, then send a create-view
request
without a body:
```shell
curl -i -X POST \
-H 'Content-Type: application/vnd.gravitino.v1+json' \
-H 'Accept: application/vnd.gravitino.v1+json' \
'http://localhost:8090/api/metalakes/test/catalogs/catalog1/schemas/default/views'
```
Expected:
- HTTP 400
- A structured `ErrorResponse`
- Error code `1001`
- Error type `IllegalArgumentException`
- A message indicating that the request body cannot be null
Actual:
- HTTP 500
- Empty response body
### Additional context
This was also noted separately in #12729, whose primary scope is the missing
authorization interception for view operations. This issue intentionally
covers
only null/empty request-body handling in `ViewOperations.createView`.
The fix should follow the established
`MetalakeOperations.createMetalake` null-request pattern. Existing malformed
JSON handling must remain unchanged and continue to use the registered JSON
exception mappers.
--
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]