[ 
https://issues.apache.org/jira/browse/HDDS-2137?focusedWorklogId=314095&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-314095
 ]

ASF GitHub Bot logged work on HDDS-2137:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 18/Sep/19 00:55
            Start Date: 18/Sep/19 00:55
    Worklog Time Spent: 10m 
      Work Description: bharatviswa504 commented on pull request #1455: 
HDDS-2137 : OzoneUtils to verify resourceName using HddsClientUtils
URL: https://github.com/apache/hadoop/pull/1455#discussion_r325443331
 
 

 ##########
 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:
   `if (resName.charAt(resName.length() - 1 == '-' || 
resName.charAt(resName.length() - 1 == '-') {`
 
----------------------------------------------------------------
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:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 314095)
    Time Spent: 2h  (was: 1h 50m)

> HddsClientUtils and OzoneUtils have duplicate verifyResourceName()
> ------------------------------------------------------------------
>
>                 Key: HDDS-2137
>                 URL: https://issues.apache.org/jira/browse/HDDS-2137
>             Project: Hadoop Distributed Data Store
>          Issue Type: Improvement
>          Components: Ozone Client
>    Affects Versions: 0.5.0
>            Reporter: Viraj Jasani
>            Assignee: Viraj Jasani
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 0.5.0
>
>          Time Spent: 2h
>  Remaining Estimate: 0h
>
> HddsClientUtils and OzoneUtils can share the method to verify resource name 
> that verifies if the bucket/volume name is a valid DNS name.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to