You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gravitino.apache.org by "10000JI (via GitHub)" <gi...@apache.org> on 2025/08/15 12:10:36 UTC
[PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
10000JI opened a new pull request, #8121:
URL: https://github.com/apache/gravitino/pull/8121
## What changes were proposed in this pull request?
Add null safety checks in CatalogCreateRequest constructor to prevent NullPointerException when type is null and provider is "hadoop". Additionally, add a comprehensive test case to verify the fix works correctly and throws IllegalArgumentException instead of NPE.
## Why are the changes needed?
- The constructor was vulnerable to NPE when `this.provider.equalsIgnoreCase("hadoop")` was called with a null provider
- When type is null and provider is "hadoop", `CatalogProvider.shortNameForManagedCatalog(type)` would throw NPE
- As mentioned by @justinmclean, relying on validate() call order is brittle and a simple defensive check costs nothing while hardening the code
- Addresses the issue raised in #8082 where validate() was not being called
Fix: #8085
## Does this PR introduce any user-facing change?
No, this is purely a defensive programming improvement. The behavior for valid inputs remains unchanged, and invalid inputs now throw clear IllegalArgumentException with descriptive messages instead of cryptic NPE.
## How was this patch tested?
- Existing unit tests continue to pass, ensuring no functional regression
- Added a new test case `testCatalogCreateRequestNullTypeHadoopProvider()` to verify NPE scenario throws IllegalArgumentException instead
- Local testing completed successfully with Gradle build and Spotless formatting
- All common module tests pass
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
Posted by "10000JI (via GitHub)" <gi...@apache.org>.
10000JI commented on PR #8121:
URL: https://github.com/apache/gravitino/pull/8121#issuecomment-3191373620
Hi @justinmclean !
Thanks for the clear issue description and test case—it really helped me understand the problem.
I've implemented the NPE fix as you suggested. As a first-time contributor, I’d appreciate any feedback on my approach.
Thanks!
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
Posted by "justinmclean (via GitHub)" <gi...@apache.org>.
justinmclean merged PR #8121:
URL: https://github.com/apache/gravitino/pull/8121
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
Posted by "10000JI (via GitHub)" <gi...@apache.org>.
10000JI commented on PR #8121:
URL: https://github.com/apache/gravitino/pull/8121#issuecomment-3193616916
@justinmclean
All checks passed! Please review and merge when convenient. Thanks!
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
Posted by "10000JI (via GitHub)" <gi...@apache.org>.
10000JI commented on PR #8121:
URL: https://github.com/apache/gravitino/pull/8121#issuecomment-3195726288
> Thanks for working on this.
Glad to contribute. Thanks for your time!
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
Posted by "injae-kim (via GitHub)" <gi...@apache.org>.
injae-kim commented on PR #8121:
URL: https://github.com/apache/gravitino/pull/8121#issuecomment-3191585505
Fixes: https://github.com/apache/gravitino/issues/8085
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [#8085] fix: NPE in CatalogCreateRequest constructor when type is null [gravitino]
Posted by "10000JI (via GitHub)" <gi...@apache.org>.
10000JI commented on PR #8121:
URL: https://github.com/apache/gravitino/pull/8121#issuecomment-3195722360
Glad to contribute. Thanks for your time!
--
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: commits-unsubscribe@gravitino.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org