virajjasani commented on a change in pull request #1455: HDDS-2137 : OzoneUtils
to verify resourceName using HddsClientUtils
URL: https://github.com/apache/hadoop/pull/1455#discussion_r325517082
##########
File path:
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/client/HddsClientUtils.java
##########
@@ -126,75 +126,63 @@ public static long formatDateTime(String date) throws
ParseException {
.toInstant().toEpochMilli();
}
-
-
/**
* verifies that bucket name / volume name is a valid DNS name.
*
* @param resName Bucket or volume Name to be validated
*
* @throws IllegalArgumentException
*/
- public static void verifyResourceName(String resName)
- throws IllegalArgumentException {
-
+ public static void verifyResourceName(String resName) throws
IllegalArgumentException {
if (resName == null) {
throw new IllegalArgumentException("Bucket or Volume name is null");
}
- if ((resName.length() < OzoneConsts.OZONE_MIN_BUCKET_NAME_LENGTH) ||
- (resName.length() > OzoneConsts.OZONE_MAX_BUCKET_NAME_LENGTH)) {
+ if (resName.length() < OzoneConsts.OZONE_MIN_BUCKET_NAME_LENGTH ||
+ resName.length() > OzoneConsts.OZONE_MAX_BUCKET_NAME_LENGTH) {
throw new IllegalArgumentException(
- "Bucket or Volume length is illegal, " +
- "valid length is 3-63 characters");
+ "Bucket or Volume length is illegal, valid length is 3-63
characters");
}
- if ((resName.charAt(0) == '.') || (resName.charAt(0) == '-')) {
+ if (resName.charAt(0) == '.' || resName.charAt(0) == '-') {
throw new IllegalArgumentException(
"Bucket or Volume name cannot start with a period or dash");
}
if ((resName.charAt(resName.length() - 1) == '.') ||
Review comment:
Done. Thanks for the review @bharatviswa504
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]