Skip to content

Improve exception handling for missing converters - #7327

Draft
andreas-grafenberger wants to merge 6 commits into
aws:masterfrom
andreas-grafenberger:feature/improve_missing_converters_exception_handling
Draft

Improve exception handling for missing converters#7327
andreas-grafenberger wants to merge 6 commits into
aws:masterfrom
andreas-grafenberger:feature/improve_missing_converters_exception_handling

Conversation

@andreas-grafenberger

@andreas-grafenberger andreas-grafenberger commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

The Enhanced Client currently fails to build converters for collection fields such as Map<String, Object>, Set<Object>, and List<Object> with an unhelpful Index: 0 exception.

This occurs because DefaultAttributeConverterProvider.findConverterInternal(EnhancedType<T> type) checks collection assignability in the wrong direction. As a result, broad types such as Object.class can be incorrectly treated as Map, Set, or List types, even though they do not provide the required generic type parameters.

This PR corrects these checks so unsupported collection types fail with a meaningful converter-not-found error instead of exposing an internal generic-type-list implementation detail.

See also:

Reference Customer need Status
Issue #1902 Support arbitrary and searchable Map<String, Object> values Closed feature request
Issue #2296 Correct the reversed type check that treats Object as a map Open bug, P2
Issue #3845 Replace the internal exception with a clear converter-not-found error Open feature request, P2
PR #5538 Validate converter input and improve the error Open and unmerged

Modifications

  • Updated the collection type checks in DefaultAttributeConverterProvider.findConverterInternal(EnhancedType<T> type) to use exact type matching.

    Previous behavior:

    if (type.rawClass().isAssignableFrom(Map.class)) {
    } else if (type.rawClass().isAssignableFrom(Set.class)) {
    } else if (type.rawClass().isAssignableFrom(List.class)) {
    }

    New behavior:

    if (Map.class.equals(type.rawClass())) {
    } else if (Set.class.equals(type.rawClass())) {
    } else if (List.class.equals(type.rawClass())) {
    }
  • Prevented Object.class and other broad types from being incorrectly interpreted as Map, Set, or List types.

  • Changed failures for unsupported collection types such as Map<String, Object>, Set<Object>, and List<Object> from the internal Index: 0 error to a meaningful converter-not-found error, for example:

    IllegalStateException: Converter not found for EnhancedType(Map<String, Object>)
    
  • Applications that require support for these types can continue to register custom AttributeConverter implementations.

Testing

Test Coverage on modified classes

TBC

Test Coverage Checklist

TBC

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the CONTRIBUTING document
  • Local run of mvn install succeeds
  • My code follows the code style of this project
  • My change requires a change to the Javadoc documentation
  • I have updated the Javadoc documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed
  • I have added a changelog entry. Adding a new entry must be accomplished by running the scripts/new-change script and following the instructions. Commit the new file created by the script in .changes/next-release with your changes.
  • My change is to implement 1.11 parity feature and I have updated LaunchChangelog

License

  • I confirm that this pull request can be released under the Apache 2 license

@andreas-grafenberger
andreas-grafenberger requested a review from a team as a code owner August 27, 2026 07:47
@andreas-grafenberger
andreas-grafenberger marked this pull request as draft August 27, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants