sachinnn99 commented on code in PR #10871:
URL: https://github.com/apache/gravitino/pull/10871#discussion_r3158883417


##########
server/src/test/java/org/apache/gravitino/server/web/rest/TestCatalogOperations.java:
##########
@@ -588,6 +588,22 @@ public void testSetCatalog() {
     Assertions.assertEquals(RuntimeException.class.getSimpleName(), 
errorResponse1.getType());
   }
 
+  @Test
+  public void testCreateCatalogWithNullRequest() {
+    Response resp =
+        target("/metalakes/metalake1/catalogs")
+            .request(MediaType.APPLICATION_JSON_TYPE)
+            .accept("application/vnd.gravitino.v1+json")
+            .post(Entity.entity("null", MediaType.APPLICATION_JSON_TYPE));

Review Comment:
   Thanks @jerryshao. I looked into a centralized fix as you suggested:
   
   - Jackson has no `DeserializationFeature` for rejecting null top-level POJO 
deserialization
   - `ContainerRequestFilter` runs before deserialization, so it can't catch 
`"null"` JSON (the body is present, it just deserializes to Java `null`)
   - The viable centralized options are Bean Validation (`@NotNull` + 
`jersey-bean-validation`) or a custom `MessageBodyReader` — both are worth 
exploring but are larger scope than this issue
   
   I'll close this PR for now. If you'd be open to a centralized approach, I 
can open a separate issue for that.



-- 
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