Improve exception handling for missing converters - #7327
Open
andreas-grafenberger wants to merge 1 commit into
Open
Improve exception handling for missing converters#7327andreas-grafenberger wants to merge 1 commit into
andreas-grafenberger wants to merge 1 commit into
Conversation
andreas-grafenberger
marked this pull request as draft
August 27, 2026 08:08
andreas-grafenberger
force-pushed
the
feature/improve_missing_converters_exception_handling
branch
from
September 3, 2026 06:20
27fedb8 to
c3b8815
Compare
anasatirbasa
force-pushed
the
feature/improve_missing_converters_exception_handling
branch
2 times, most recently
from
September 4, 2026 15:05
d313166 to
6a44db3
Compare
andreas-grafenberger
marked this pull request as ready for review
September 4, 2026 15:20
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.
Motivation and Context
The DynamoDB Enhanced Client requires generic type information to create collection converters. Raw
Map,Set, andListdeclarations do not provide that information. Earlier converter resolution could access a missing type parameter and throw anIndexOutOfBoundsException.Plain
Objectrequires separate handling. BecauseObjectis a supertype of the collection interfaces, it could enter collection routing even though it is not a collection and the default provider has noObjectconverter.Nested collection failures also did not always identify the actual missing type. For example,
Map<String, Object>requires a converter forObject, so the error should identifyObjectrather than the enclosing map.Changes
This change improves validation and diagnostics while preserving existing collection-routing behavior.
DefaultAttributeConverterProviderexcludes plainObjectfrom collection routing.Map,Set, andListdeclarations are validated before their type parameters are accessed.DefaultEnhancedDocumentapplies the sameObjectguard and raw-type validation to its direct list and map conversion paths.Objectand other custom types. Applications can provide anAttributeConverter<Object>when they define the required serialization behavior.Behavior and Compatibility
The existing collection-routing precedence remains map, then set, then list. This preserves the existing behavior of
Collection<T>andIterable<T>, which resolve through the set converter.Map<String, Integer>,Set<String>, andList<String>Collection<String>andIterable<String>SequencedCollection<String>Map,Set, andListIllegalStateExceptionstating that type parameters are required.Objectwith only default convertersObjectconverter exists.Map<String, Object>,Set<Object>, andList<Object>with only default convertersConverter not found for EnhancedType(java.lang.Object).Objectwith a custom converterAttributeConverter<Object>.HashMap,HashSet,ArrayList, and other concrete collection declarationsNo public APIs, annotations, schemas, dependencies, or DynamoDB wire representations are changed.
Testing
The updated tests cover converter lookup, caching, conversion, and registration. They cover parameterized and raw
Map,Set,List,Collection, andIterabledeclarations, concrete collection implementations, plainObject, customObjectconverters, and nested missing member types.Bean, immutable, document, static, static immutable, nested, and flattened schema paths are covered. Existing sync and async CRUD, scan, query, batch, transaction, null handling, and extension tests continue to exercise the Enhanced Client.
Test Coverage on modified classes
Test coverage checklist
TableSchema.fromBean(Customer.class)TableSchema.fromImmutableClass(Customer.class)TableSchema.documentSchemaBuilder().build()StaticTableSchema.builder(Customer.class)scan()query()updateItem()putItem()getItem()deleteItem()batchGetItem()batchWriteItem()transactGetItems()transactWriteItems()AttributeValueDynamoDbAsyncTableDynamoDbTableDefaultAttributeConverterProviderCacheTestcovers converter caching.ChainExtensionTestcoverage.FlattenWithTagsTestcoverage.batchGetbatchGetrequest changes.batchWritebatchWriterequest changes.transactGettransactGetrequest changes.transactWritetransactWriterequest changes.Types of changes
Checklist
mvn installsucceeds.License