Skip to content

Handle null when serializing enum to string #6342

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

RanVaknin
Copy link
Contributor

Motivation and Context

#3861

Modifications

Updated MemberCopierSpec.java to generate a null check before calling `entry.toString() when serializing enums to strings.

Testing

  • Updated codegen fixture files with the expected code generated content
  • Added a unit test to verify that null enum doesn't throw NPE.

@RanVaknin RanVaknin requested a review from a team as a code owner August 13, 2025 20:26
@RanVaknin RanVaknin added changelog-not-required Indicate changelog entry is not required for a specific PR no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required labels Aug 13, 2025
@RanVaknin
Copy link
Contributor Author

Flakey integ test failure S3TransferManagerDownloadPauseResumeIntegrationTest , should be safe to merge.

@zoewangg
Copy link
Contributor

Can we add a changelog entry? Changelog entry is not required only for house keeping changes such as test code or README update

@zoewangg zoewangg removed the changelog-not-required Indicate changelog entry is not required for a specific PR label Aug 15, 2025
@joviegas
Copy link
Contributor

Can we add a test case in the protocol test , may be src/main/resources/software/amazon/awssdk/protocol/suites/cases/json-core-input.json ?
something like

{
  "description": "List of enums with null values are marshalled correctly without NPE",
  "given": {
    "input": {
      "ListOfEnums": [
        "EnumValue1",
        null,
        "EnumValue2"
      ]
    }
  },
  "when": {
    "action": "marshall",
    "operation": "AllTypes"
  },
  "then": {
    "serializedAs": {
      "body": {
        "jsonEquals": "{\"ListOfEnums\": [\"EnumValue1\", null, \"EnumValue2\"]}"
      }
    }
  }
}

same for maps so we know what we are sending on the wire

Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-api-surface-area-change Indicate there is no API surface area change and thus API surface area review is not required
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants