ashishkumar50 commented on code in PR #10980:
URL: https://github.com/apache/ozone/pull/10980#discussion_r3747399351


##########
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:
   Instead of hardcoding, good to define constant and use everywhere for 
`Enabled/Disabled`.



##########
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:
   You can use `StringUtils.isEmpty(status)`



##########
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:
   Verify valid input for both `Enabled` and `Disabled`.



-- 
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]

Reply via email to