kenny-ish opened a new pull request, #14329:
URL: https://github.com/apache/gravitino/pull/14329
### What changes were proposed in this pull request?
`MetadataObjectSecretOperations.getSecrets` now throws
`IllegalArgumentException` instead of `javax.ws.rs.NotSupportedException` when
the object type cannot hold secrets. `SecretExceptionHandler` already maps
`IllegalArgumentException` to 400, so the request returns 400 with the existing
message. `StatisticOperations` rejects unsupported object types in the same way.
### Why are the changes needed?
`SecretExceptionHandler` only handles `IllegalArgumentException`,
`NotFoundException` and `NotInUseException`. The `NotSupportedException` thrown
for types such as tag and column fell through to the base handler, so `GET
/api/metalakes/{metalake}/objects/{type}/{fullName}/secrets` returned 500 for a
client error.
Fixes #14305
### Does this PR introduce _any_ user-facing change?
Yes. Reading secrets of an object type that cannot hold secrets now returns
HTTP 400 (`IllegalArgumentException`, code 1001) instead of HTTP 500. The
message is unchanged.
### How was this patch tested?
Added `testGetSecretsForUnsupportedObjectType` to
`TestMetadataObjectSecretOperations`, which requests secrets of a tag and a
column and checks for 400. The test fails with 500 without the fix.
- `./gradlew :server:test --tests
org.apache.gravitino.server.web.rest.TestMetadataObjectSecretOperations`
- `./gradlew :server:test --tests
'org.apache.gravitino.server.web.rest.TestMetadataObject*'`
- `./gradlew :server:spotlessCheck`
--
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]