hemantk-12 commented on code in PR #5814:
URL: https://github.com/apache/ozone/pull/5814#discussion_r1431007034


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/OmUtils.java:
##########
@@ -629,15 +629,36 @@ public static void 
verifyKeyNameWithSnapshotReservedWord(String keyName)
         if (keyName.substring(OM_SNAPSHOT_INDICATOR.length())
             .startsWith(OM_KEY_PREFIX)) {
           throw new OMException(
-              "Cannot create key under path reserved for "
-                  + "snapshot: " + OM_SNAPSHOT_INDICATOR + OM_KEY_PREFIX,
+              "Cannot create key under path reserved for snapshot: " + 
OM_SNAPSHOT_INDICATOR + OM_KEY_PREFIX,
               OMException.ResultCodes.INVALID_KEY_NAME);
         }
       } else {
-        // We checked for startsWith OM_SNAPSHOT_INDICATOR and the length is
+        // We checked for startsWith OM_SNAPSHOT_INDICATOR, and the length is
         // the same, so it must be equal OM_SNAPSHOT_INDICATOR.
-        throw new OMException(
-            "Cannot create key with reserved name: " + OM_SNAPSHOT_INDICATOR,
+        throw new OMException("Cannot create key with reserved name: " + 
OM_SNAPSHOT_INDICATOR,
+            OMException.ResultCodes.INVALID_KEY_NAME);
+      }
+    }
+  }
+
+  /**
+   * Verify if key name contains snapshot reserved word.
+   * This is similar to verifyKeyNameWithSnapshotReservedWord. The only 
difference is exception message.
+   */
+  public static void verifyKeyNameWithSnapshotReservedWordForDeletion(String 
keyName)  throws OMException {

Review Comment:
   I thought about doing something similar but it comes with if-else 
conditions. So decided to keep it simple and go with this.
   
   I also did 
[this](https://github.com/apache/ozone/pull/5814/commits/1adc6b490e4718ea24e4f0f3d5ef84112999c370#diff-1a12ec76bd3be379b70f5cee5364e51d56d021af0ae2a835f466fc7441d9258eR631)
 previously but problem is that exception message is different for 
keyName(fileName) and dirName.



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