Skip to content

Include mime.types in sdk-core native image resources - #7064

Closed
sjh9714 wants to merge 1 commit into
aws:masterfrom
sjh9714:fix-native-image-mime-types
Closed

Include mime.types in sdk-core native image resources#7064
sjh9714 wants to merge 1 commit into
aws:masterfrom
sjh9714:fix-native-image-mime-types

Conversation

@sjh9714

@sjh9714 sjh9714 commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Fixes #7063.

sdk-core loads software/amazon/awssdk/core/util/mime.types for default MIME type detection, but the native-image resource configuration did not include that resource. In GraalVM native images, known file extensions can then fall back to application/octet-stream because the MIME table is unavailable.

This submission was generated by AI tools and reviewed by sjh9714.

Modifications

  • Add the sdk-core mime.types resource to resource-config.json for native-image builds.
  • Add a focused MimetypeTest assertion that the native-image resource config includes the MIME table resource.
  • Add the required next-release changelog entry.

Testing

  • Red check before the resource-config fix: ./mvnw -q -pl :sdk-core -am -Dtest=MimetypeTest#nativeImageResourceConfig_includesMimeTypes -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Dspotbugs.skip=true -Dcheckstyle.skip=true test
  • Green check after the fix: ./mvnw -q -pl :sdk-core -am -Dtest=MimetypeTest#nativeImageResourceConfig_includesMimeTypes -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Dspotbugs.skip=true -Dcheckstyle.skip=true test
  • ./mvnw -q -pl :sdk-core -am -Dtest=MimetypeTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false -Dspotbugs.skip=true -Dcheckstyle.skip=true test
  • JAVA_HOME=$(/usr/libexec/java_home -v 17) ./mvnw -q -pl :sdk-core -am -Dtest=MimetypeTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false test

Note: I also tried the Java 21 targeted reactor without skipping SpotBugs, but SpotBugs failed before reaching sdk-core with DirectoryNotEmptyException for core/annotations/target/classes. The Java 17 command above uses the repository's Java-17 profile, which skips SpotBugs and runs the focused test class successfully.

Screenshots (if appropriate)

N/A

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

@zoewangg

Copy link
Copy Markdown
Contributor

Thank you for your contribution! Merged through #7065

@zoewangg zoewangg closed this Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pattern in sdk-core resource-config.json excludes mime.types

2 participants