F64116045 commented on code in PR #10980:
URL: https://github.com/apache/ozone/pull/10980#discussion_r3754233008
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/S3LifecycleConfiguration.java:
##########
@@ -312,13 +312,17 @@ public OmLifecycleConfiguration
toOmLifecycleConfiguration(OzoneBucket ozoneBuck
* @return OmLCRule internal rule representation
*/
private OmLCRule convertToOmRule(Rule rule) throws OMException, OS3Exception
{
- if (rule.getStatus() == null || rule.getStatus().isEmpty()) {
+ String status = rule.getStatus();
+ if (status == null || status.isEmpty()) {
throw S3ErrorTable.newError(S3ErrorTable.MALFORMED_XML,
"The Status element is required in LifecycleConfiguration");
}
+ if (!"Enabled".equals(status) && !"Disabled".equals(status)) {
Review Comment:
Updated to use STATUS_ENABLED and STATUS_DISABLED in the validation and
builder mapping. Thanks.
##########
hadoop-ozone/s3gateway/src/test/java/org/apache/hadoop/ozone/s3/endpoint/TestS3LifecycleConfigurationPut.java:
##########
@@ -171,6 +183,7 @@ public void testPutInvalidExpirationDateLCC() throws
Exception {
@Test
public void testPutValidLifecycleConfiguration() throws Exception {
assertEquals(HTTP_OK, bucketEndpoint.put("bucket1",
onePrefix()).getStatus());
+ assertEquals(HTTP_OK, bucketEndpoint.put("bucket1",
withStatus("Disabled")).getStatus());
Review Comment:
Added the `Enabled` test, thanks.
##########
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/S3LifecycleConfiguration.java:
##########
@@ -312,13 +312,17 @@ public OmLifecycleConfiguration
toOmLifecycleConfiguration(OzoneBucket ozoneBuck
* @return OmLCRule internal rule representation
*/
private OmLCRule convertToOmRule(Rule rule) throws OMException, OS3Exception
{
- if (rule.getStatus() == null || rule.getStatus().isEmpty()) {
+ String status = rule.getStatus();
+ if (status == null || status.isEmpty()) {
Review Comment:
Updated to use StringUtils.isEmpty(status). Thanks.
--
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]