Copilot commented on code in PR #10850:
URL: https://github.com/apache/ozone/pull/10850#discussion_r3644285312
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/S3LifecycleConfiguration.java:
##########
@@ -479,7 +479,7 @@ private static Expiration convertFromOzoneExpiration(
if (date != null && !date.isEmpty()) {
expiration.setDate(date);
}
- if (ozoneExpiration.getDays() > 0) {
+ if (ozoneExpiration.getDays() != null && ozoneExpiration.getDays() > 0) {
expiration.setDays(ozoneExpiration.getDays());
}
Review Comment:
`ozoneExpiration.getDays()` is invoked multiple times inside the
null/positive check and again when setting the value. Storing it in a local
variable avoids duplicated calls and eliminates any risk of the value changing
between the check and the use.
This issue also appears on line 498 of the same file.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]