Aditi102005 opened a new pull request, #10298:
URL: https://github.com/apache/gravitino/pull/10298

   ## What changes were proposed in this pull request?
   
   This PR fixes a potential `NullPointerException` in 
`TagMetaService#getTagIdByTagName`.
   
   Previously, the method directly dereferenced the result returned by
   `selectTagMetaByMetalakeIdAndName(...)` and called `.getTagId()` without 
checking if the returned `TagPO` was `null`. If the tag did not exist (or was 
concurrently deleted), this could result in a `NullPointerException`.
   
   This change adds a null check and throws a `NoSuchEntityException` when the 
tag is not found. This behavior aligns with other meta services (e.g., 
role/user/group) that throw domain-level exceptions when entities are missing.
   
   ## How was this patch tested?
   
   * Added a new unit test `testGetTagIdByTagNameWhenTagNotFound` in 
`TestTagMetaService`.
   * The test verifies that `NoSuchEntityException` is thrown when attempting 
to retrieve a tag ID for a non-existent tag.
   * Ran the full `:core:test` suite locally and all tests passed successfully.
   
   ## Does this PR introduce any user-facing change?
   
   No user-facing changes. This improves internal error handling and prevents 
unexpected `NullPointerException`s.
   
   Fixed #10221 


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