Open MichalFab opened 1 year ago
@MichalFab we don't have a native AttributeConverter for the Object
type, my guess this causing the error.
You can write a custom AttributeConverter, or use one of the types that the SDK provides a converter by default - you can see the list in the "All Known Implementing Classes" here : https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/AttributeConverter.html)
We have some examples showing how to provide a custom AttributeConverter in the Enhanced Client Overview : https://github.com/aws/aws-sdk-java-v2/tree/master/services-custom/dynamodb-enhanced#control-attribute-conversion
@MichalFab we don't have a native AttributeConverter for the
Object
type, my guess this causing the error.You can write a custom AttributeConverter, or use one of the types that the SDK provides a converter by default - you can see the list in the "All Known Implementing Classes" here : https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/enhanced/dynamodb/AttributeConverter.html)
We have some examples showing how to provide a custom AttributeConverter in the Enhanced Client Overview : https://github.com/aws/aws-sdk-java-v2/tree/master/services-custom/dynamodb-enhanced#control-attribute-conversion
@debora-ito , thanks for the response. I know that there is no dedicated converter, but it seems to me that the library should handle such a case by logging an appropriate error instead of throwing a IndexOutOfBoundsException
Oh I see, the "bug" threw me off. We can improve the error message, I agree. Changing this to a feature request then.
Describe the bug
DefaultAttributeConverterProvider.findConverter(EnhancedType type) throws java.lang.IndexOutOfBoundsException: Index: 0 when cannot find a converter for Map<String,Object>.
Expected Behavior
DefaultAttributeConverterProvider.findConverter(EnhancedType type) should log "No converter available for (..)" when it cannot find a converter for Map<String, Object>.
Current Behavior
The method Optional<AttributeConverter> converter = this.findConverterInternal(type); cannot resolve finding the missing converter for objects of type Map<String, Object>. Stacktrace with error:
Reproduction Steps
Create the DynamoDbEnhancedAsyncClient instance, e.g: ` DynamoDbAsyncClientBuilder asyncClientBuilder = DynamoDbAsyncClient.builder();
if (endpoint != null) { try { asyncClientBuilder.endpointOverride(new URI("your endpoint)); } catch (Exception e) { logger.error("Failed to setup up custom endpoint " + endpoint, e); } }
return DynamoDbEnhancedAsyncClient.builder() .dynamoDbClient(asyncClientBuilder.build()) .build(); }`
Possible Solution
No response
Additional Information/Context
No response
AWS Java SDK version used
2.20.27
JDK version used
17
Operating System and version
Mac OS Ventura 13.1