-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix NPE in s3 scan partition supplier #3317
Conversation
Signed-off-by: Taylor Gray <[email protected]>
@@ -101,7 +101,7 @@ private List<PartitionIdentifier> listFilteredS3ObjectsForBucket(final List<Stri | |||
final LocalDateTime endDateTime, | |||
final Map<String, Object> globalStateMap) { | |||
|
|||
Instant mostRecentLastModifiedTimestamp = globalStateMap.containsKey(bucket) ? Instant.parse((String) globalStateMap.get(bucket)) : null; | |||
Instant mostRecentLastModifiedTimestamp = globalStateMap.containsKey(bucket) && Objects.nonNull(globalStateMap.get(bucket)) ? Instant.parse((String) globalStateMap.get(bucket)) : null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
globalStateMap.containsKey(bucket) && Objects.nonNull(globalStateMap.get(bucket))
can simplify to globalStateMap.get(bucket) != null
Also, Objects.nonNull
is not necessary here. It is intended for use where a Predicate
is needed.
Signed-off-by: Taylor Gray <[email protected]>
@graytaylor0 , We should probably have a unit test here as well. |
Signed-off-by: Taylor Gray <[email protected]>
Fix potential NPE in s3 scan partition supplier Signed-off-by: Taylor Gray <[email protected]> (cherry picked from commit f61338a)
Fix potential NPE in s3 scan partition supplier Signed-off-by: Taylor Gray <[email protected]> (cherry picked from commit f61338a) Co-authored-by: Taylor Gray <[email protected]>
Description
Fixes a potential NPE in the s3 scan partition supplier
Issues Resolved
Resolves #3316
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.