Skip to content

Fix UnsupportedOperationException in auto gen timestamps for custom TableSchema#6886

Merged
aws-sdk-java-automation merged 1 commit intomasterfrom
fix_enhanced_timestamp_2
Apr 22, 2026
Merged

Fix UnsupportedOperationException in auto gen timestamps for custom TableSchema#6886
aws-sdk-java-automation merged 1 commit intomasterfrom
fix_enhanced_timestamp_2

Conversation

@alextwoods
Copy link
Copy Markdown
Contributor

Fix AutoGeneratedTimestampRecordExtension throwing UnsupportedOperationException when used with TableSchema implementations that do not override converterForAttribute, such as DocumentTableSchema or custom or third-party schemas.

Motivation and Context

Fixes a regression introduced by PR #6546 (nested record timestamp support). When AutoGeneratedTimestampRecordExtension is used with a TableSchema implementation that does not override converterForAttribute — such as DocumentTableSchema or third-party schemas like DynamoKt's DataClassTableSchema — the extension throws UnsupportedOperationException during beforeWrite for any item containing Map-valued or List-of-Maps attributes.

The root cause is that processDirectNestedAttributes unconditionally calls converterForAttribute on the table schema for every Map-valued attribute in the item. The converterForAttribute method has a default implementation in the TableSchema interface that throws UnsupportedOperationException, and not all implementations override it.

Modifications

In EnhancedClientUtils.getNestedSchema() and NestedRecordUtils.getTableSchemaForListElement(), wrapped the converterForAttribute call in a try-catch for UnsupportedOperationException. When caught, the methods return Optional.empty() or null respectively, which callers already handle by skipping nested schema introspection for that attribute.

Testing

Added new unit and functional tests that cover this. Additionally manually reproduced issue on a complex model with DynamoKt.

Screenshots (if appropriate)

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.

License

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

@alextwoods alextwoods requested a review from a team as a code owner April 22, 2026 17:23
@sonarqubecloud
Copy link
Copy Markdown

@aws-sdk-java-automation aws-sdk-java-automation merged commit c6cc83d into master Apr 22, 2026
37 of 39 checks passed
@aws-sdk-java-automation aws-sdk-java-automation deleted the fix_enhanced_timestamp_2 branch April 22, 2026 18:20
@github-actions
Copy link
Copy Markdown

This pull request has been closed and the conversation has been locked. Comments on closed PRs are hard for our team to see. If you need more assistance, please open a new issue that references this one.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Apr 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants