You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DynamoDB enhanced client: TableSchema<T>.attributeValue method throws NullPointerException when retrieving value of an attribute of a flattened model #4218
When calling TableSchema<T>.attributeValue on an attribute of a flattened model, method throws a NullPointerException if the value of the attribute is currently set to null. If attribute's value is not null or the whole flattened model is null, method behaves as expected.
Expected Behavior
Expected behavior for TableSchema<T>.attributeValue would be to return null or AttributeValue wrapped null.
Current Behavior
Currently TableSchema<T>.attributeValue throws a NullPointerException
Exception in thread "main" java.lang.NullPointerException
at software.amazon.awssdk.enhanced.dynamodb.internal.EnhancedClientUtils.isNullAttributeValue(EnhancedClientUtils.java:187)
at software.amazon.awssdk.enhanced.dynamodb.mapper.StaticImmutableTableSchema$FlattenedMapper.attributeValue(StaticImmutableTableSchema.java:144)
at software.amazon.awssdk.enhanced.dynamodb.mapper.StaticImmutableTableSchema$FlattenedMapper.access$1300(StaticImmutableTableSchema.java:91)
at software.amazon.awssdk.enhanced.dynamodb.mapper.StaticImmutableTableSchema.attributeValue(StaticImmutableTableSchema.java:559)
at software.amazon.awssdk.enhanced.dynamodb.mapper.WrappedTableSchema.attributeValue(WrappedTableSchema.java:77)
at software.amazon.awssdk.enhanced.dynamodb.mapper.WrappedTableSchema.attributeValue(WrappedTableSchema.java:77)
at org.example.Main.main(Main.java:22)
AWS Java SDK version used
2.20.105
JDK version used
openjdk version "11.0.18" 2023-01-17 LTS OpenJDK Runtime Environment Corretto-11.0.18.10.1 (build 11.0.18+10-LTS) OpenJDK 64-Bit Server VM Corretto-11.0.18.10.1 (build 11.0.18+10-LTS, mixed mode)
Operating System and version
Linux pc 6.3.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Wed, 14 Jun 2023 20:10:31 +0000 x86_64 GNU/Linux
changed the title [-]TableSchema<T>.attributeValue method throws NullPointerException when retrieving value of an attribute of a flattened model [/-][+]DynamoDB enhanced client: TableSchema<T>.attributeValue method throws NullPointerException when retrieving value of an attribute of a flattened model [/+]on Jul 25, 2023
This is actually documented in EnhancedClientUtils#isNullAttributeValue javadoc here:
A helper method to test if an AttributeValue is a 'null' constant. This will not test if the AttributeValue object is null itself, and in fact will throw a NullPointerException if you pass in null.
But I understand getting a NPE is not a good experience.
Activity
[-]TableSchema<T>.attributeValue method throws NullPointerException when retrieving value of an attribute of a flattened model [/-][+]DynamoDB enhanced client: TableSchema<T>.attributeValue method throws NullPointerException when retrieving value of an attribute of a flattened model [/+]debora-ito commentedon Aug 9, 2023
Noted.
This is actually documented in
EnhancedClientUtils#isNullAttributeValuejavadoc here:But I understand getting a NPE is not a good experience.