Skip to content

Conversation

@swagle
Copy link
Contributor

@swagle swagle commented Nov 15, 2019

What changes were proposed in this pull request?

Fix the sonarlint issues found in ObjectEndpoint class. The only ones not addressed: Logging and re-throwing Exception and TODOs. This is an Endpoint API class and hence should log errors unlike lower layers in the service.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-2501

How was this patch tested?

Only syntactic changes done, waiting on UT results.

LOG.error("Error in Initiate Multipart Upload Request for bucket: " +
bucket + ", key: " + key, ex);
LOG.error("Error in Initiate Multipart Upload Request for bucket: {}, " +
"key: ", bucket, key, ex);
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing {} for parameter key

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for catching this, updating.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a comment

Choose a reason for hiding this comment

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

One minor comment rest LGTM.

Copy link
Contributor

@bharatviswa504 bharatviswa504 left a comment

Choose a reason for hiding this comment

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

+1 LGTM.

Copy link
Contributor

@dineshchitlangia dineshchitlangia left a comment

Choose a reason for hiding this comment

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

+1 LGTM. Failures are unrelated. Thanks @swagle for the fix @bharatviswa504 for reviews.

@dineshchitlangia dineshchitlangia merged commit 493a916 into apache:master Nov 16, 2019
} else {
IOUtils.copy(body, ozoneOutputStream);
omMultipartCommitUploadPartInfo = ozoneOutputStream
.getCommitUploadPartInfo();
Copy link
Contributor

Choose a reason for hiding this comment

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

It turns out this should be called only after ozoneOutputStream is closed (see #206).

Comment on lines +236 to +238
if (LOG.isDebugEnabled()) {
LOG.debug("range Header provided value is {}", rangeHeaderVal);
}
Copy link
Contributor

@adoroszlai adoroszlai Nov 17, 2019

Choose a reason for hiding this comment

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

Wrapping every LOG.debug in an if increases method complexity and may trigger a new Sonar warning above a threshold (it does here). I think log statements are safe to call unconditionally (both for performance and for Sonar) as long as their arguments are not eagerly evaluated. Using placeholders and passing existing objects as arguments should be OK.

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.

4 participants