fix: prevent NPE in validateDouble/validateFloat when input is null#6855
Open
anuragg-saxenaa wants to merge 2 commits intoaws:masterfrom
Open
fix: prevent NPE in validateDouble/validateFloat when input is null#6855anuragg-saxenaa wants to merge 2 commits intoaws:masterfrom
anuragg-saxenaa wants to merge 2 commits intoaws:masterfrom
Conversation
…ws#6639) Double.isNaN() and Double.isFinite() accept primitive double — Java auto-unboxes the wrapper Double, which throws NullPointerException if the wrapper is null. This crash surfaces when a Map<String,Double> or List<Double> stored in DynamoDB contains an explicit null value. Add a null guard at the top of both validateDouble() and validateFloat() that returns early; null is a valid DynamoDB NULL attribute value and the converters already handle null separately via transformFrom/transformTo. Also add ConverterUtilsTest covering null, NaN, infinite, and finite inputs for both methods. Fixes aws#6639 Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
…#6578) RetryableStage caught SdkException and IOException but not UncheckedIOException (which extends RuntimeException, not IOException). When the HTTP client throws UncheckedIOException, it bypassed the catch block entirely and was never offered to the retry strategy predicates, so retryOnException(UncheckedIOException.class) had no effect. Add UncheckedIOException to the multi-catch so it is forwarded to RetryableStageHelper.tryRefreshToken and evaluated against user-supplied retry predicates like any other retriable exception. Fixes aws#6578 Signed-off-by: anuragg-saxenaa <anuragg.saxenaa@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
ConverterUtils.validateDouble(Double)andvalidateDouble(Float)accept boxed wrapper types but pass them directly toDouble.isNaN()/Double.isFinite(), which take primitivedouble. Java auto-unboxes the wrapper before calling the method — if the wrapper isnull, this auto-unboxing causes aNullPointerException.This crash surfaces in practice when using
Map<String, Double>orList<Double>DynamoDB attributes where one of the collection values is explicitlynull.Root Cause
Fix
Added a null guard at the top of both
validateDoubleandvalidateFloat:Tests
Added
ConverterUtilsTestcovering:nullinput does not throw (regression test for NullPointerException in DefaultAttributeConverterProvider when validating null Double values #6639)NaNthrowsIllegalArgumentExceptionIllegalArgumentExceptionvalidateFloatFixes #6639