aws / aws/aws-sdk-java-v2

DynamoDB Enhanced : Getting IndexOutOfBoundsException for missing converter

Open
#3,845 3 comments 0 reactions 1 assignee Claimed by @debora-ito View on GitHub
dynamodb-enhanced feature-request p2
Dominant language
Java
Stars
2.6k
Forks
1k
Avg merge
2d 9h
Merged PRs (30d)
51

Description

### Describe the bug

DefaultAttributeConverterProvider.findConverter(EnhancedType type) throws java.lang.IndexOutOfBoundsException: Index: 0 when cannot find a converter for Map.

### Expected Behavior

DefaultAttributeConverterProvider.findConverter(EnhancedType type) should log "No converter available for (..)" when it cannot find a converter for Map.

### Current Behavior

The method Optional> converter = this.findConverterInternal(type); cannot resolve finding the missing converter for objects of type Map. Stacktrace with error:
![image](https://user-images.githubusercontent.com/15208668/226286216-04ddd7f2-fbf0-4703-9c3f-89a1822454ef.png)

### Reproduction Steps

1. Create model class with @DynamoDbBean annotation.
2. Add a Map field to the created class, for example: private Map data;
3. 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();
}`
4. Run the application.

### 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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.