swamirishi commented on code in PR #5814:
URL: https://github.com/apache/ozone/pull/5814#discussion_r1430988871
##########
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:
nit: Can we create a separate private method passing the exception message
as an argument?
--
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]