rameshreddy-adutla opened a new pull request, #10215:
URL: https://github.com/apache/gravitino/pull/10215

   ### What changes were proposed in this pull request?
   
   Add namespace validation in `TopicMetaService`'s private methods that 
directly index into namespace levels, preventing 
`ArrayIndexOutOfBoundsException` on malformed input.
   
   ### Why are the changes needed?
   
   `TopicMetaService#getTopicPOByFullQualifiedName` and 
`listTopicPOsByFullQualifiedName` assume the topic namespace always has 3 
levels and directly access `namespaceLevels[0..2]`. For malformed input (fewer 
levels), this throws an uninformative `ArrayIndexOutOfBoundsException`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Internal defensive validation — the external API is unchanged. Malformed 
identifiers now produce a clear `NoSuchEntityException` instead of 
`ArrayIndexOutOfBoundsException`.
   
   ### How was this patch tested?
   
   Added unit test 
`testGetTopicByFullQualifiedNameMalformedNamespaceThrowsNoSuchEntityException` 
(as suggested in #10133) that:
   1. Uses reflection to call the private `getTopicPOByFullQualifiedName` method
   2. Passes a `NameIdentifier` with only 2-level namespace (missing schema)
   3. Asserts `NoSuchEntityException` is thrown (wrapped in 
`InvocationTargetException`)
   
   Closes #10133


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