Skip to content

Adding an explicit isPresent check in SyncHttpChecksumInTrailerInterc… #3047

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 2 commits into from
Feb 22, 2022

Conversation

joviegas
Copy link
Contributor

@joviegas joviegas commented Feb 21, 2022

…eptor to improve readibilty also to address sonarcloud bug

Motivation and Context

  • Sonarcloud complaining not doing isPresent() before .get.
  • This is just additional check since in HttpChecksumUtils.isTrailerBasedChecksumForClientType() we already to a isPresent check and donot do any checksum related operation if requestBody is not present.

Modifications

  • Added explicit isPresent check before doing a .get()

Testing

Screenshots (if appropriate)

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

@joviegas joviegas requested a review from a team as a code owner February 21, 2022 20:58
Comment on lines 93 to 101
if (checksumSpecs == null
|| !context.requestBody().isPresent()
|| !HttpChecksumUtils
.isTrailerBasedChecksumForClientType(
executionAttributes,
context.httpRequest(),
ClientType.SYNC, checksumSpecs,
context.requestBody().isPresent(),
context.requestBody().map(requestBody -> requestBody.contentStreamProvider() != null).orElse(false))) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a bit hard to read. Can we create a method for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

…eptor to improve readibilty also to address sonarcloud bug
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

90.0% 90.0% Coverage
0.0% 0.0% Duplication

@joviegas joviegas merged commit 76d48d0 into aws:master Feb 22, 2022
aws-sdk-java-automation added a commit that referenced this pull request May 24, 2024
…6f593adeb

Pull request: release <- staging/2458f92e-473c-442c-b658-d956f593adeb
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