Skip to content

Add null check for paginator hasNextPage #5139

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

Merged
merged 6 commits into from
Apr 25, 2024

Conversation

davidh44
Copy link
Contributor

Motivation and Context

Add null check for paginator hasNextPage()

Modifications

Previous

        @Override
        public boolean hasNextPage(ListAliasesResponse previousPage) {
            return previousPage.truncated().booleanValue();
        }

Updated

        @Override
        public boolean hasNextPage(ListAliasesResponse previousPage) {
            return previousPage.truncated() != null && previousPage.truncated().booleanValue();
        }

Testing

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.
  • 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

@davidh44 davidh44 requested a review from a team as a code owner April 23, 2024 21:25
@@ -169,7 +169,7 @@ protected MemberModel memberModelForResponseMember(String input) {
protected CodeBlock hasNextPageMethodBody() {
if (paginatorDefinition.getMoreResults() != null) {
return CodeBlock.builder()
.add("return $N.$L.booleanValue()",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Can we please write a codegen test with expected java class and codegen class?
  2. Also in what cases do we get this as Null ? Can we write a test case for the same

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added tests
The service will always populate the field, but customer unit tests may not populate the more_results field in the response because it previously did not exist

@davidh44 davidh44 enabled auto-merge (squash) April 25, 2024 20:34
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
33.3% Coverage on New Code (required ≥ 80%)
4.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarCloud

@davidh44 davidh44 merged commit 9fe1db8 into master Apr 25, 2024
@davidh44 davidh44 deleted the hdavidh/add-null-check-for-paginator-hasNextPage branch April 25, 2024 21:18
anirudh9391 pushed a commit that referenced this pull request Jun 7, 2024
* Add null check for paginator hasNextPage

* Add codegen tests for more_results

* Add hasNextPage null check for customized paginators

* Add unit test for null more_results field
akidambisrinivasan pushed a commit to akidambisrinivasan/aws-sdk-java-v2 that referenced this pull request Jun 28, 2024
* Add null check for paginator hasNextPage

* Add codegen tests for more_results

* Add hasNextPage null check for customized paginators

* Add unit test for null more_results field
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.

2 participants