Skip to content

Conversation

@bbdouglas
Copy link
Contributor

Commit e3d04ee (issue #5240) introduced unsafe add/put methods for optional
list/map parameters. This change maintains the spirit of issue #5240 (optional
containers are null by default) while still making add/put calls safe. It does
this by checking for null first and, if so, initializing it with an empty
container.

Also updated the affected samples using the various scripts in bin/.

PR checklist

  • Read the contribution guidelines.
  • Ran the shell/batch script under ./bin/ to update Petstore sample so that CIs can verify the change. (For instance, only need to run ./bin/{LANG}-petstore.sh and ./bin/security/{LANG}-petstore.sh if updating the {LANG} (e.g. php, ruby, python, etc) code generator or {LANG} client's mustache templates)
  • Filed the PR against the correct branch: master for non-breaking changes and 2.3.0 branch for breaking (non-backward compatible) changes.

Description of the PR

A minor change to #5363 to check for nulls before adding/putting values into optional lists/maps.

Commit e3d04ee (issue swagger-api#5240) introduced unsafe add/put methods for optional
list/map parameters. This change maintains the spirit of issue swagger-api#5240 (optional
containers are null by default) while still making add/put calls safe. It does
this by checking for null first and, if so, initializing it with an empty
container.

Also updated the affected samples using the various scripts in bin/.
@bbdouglas
Copy link
Contributor Author

Fix for #5385

@wing328 wing328 added this to the v2.2.3 milestone Apr 13, 2017
@wing328 wing328 merged commit ab69ce5 into swagger-api:master Apr 13, 2017
@wing328
Copy link
Contributor

wing328 commented Apr 13, 2017

@bbdouglas thanks for the PR, which looks good to me.

@bbdouglas bbdouglas deleted the null_list branch April 13, 2017 15:48
@wing328 wing328 changed the title Add null pointer check to add/put methods (#5385) [Java] Add null pointer check to add/put methods Apr 22, 2017
davidgri pushed a commit to davidgri/swagger-codegen that referenced this pull request May 11, 2017
…-api#5386)

Commit e3d04ee (issue swagger-api#5240) introduced unsafe add/put methods for optional
list/map parameters. This change maintains the spirit of issue swagger-api#5240 (optional
containers are null by default) while still making add/put calls safe. It does
this by checking for null first and, if so, initializing it with an empty
container.

Also updated the affected samples using the various scripts in bin/.
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