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

ASF GitHub Bot logged work on HIVE-23638:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 08/Jul/20 12:03
            Start Date: 08/Jul/20 12:03
    Worklog Time Spent: 10m 
      Work Description: pgaref commented on a change in pull request #1161:
URL: https://github.com/apache/hive/pull/1161#discussion_r451489258



##########
File path: common/src/java/org/apache/hadoop/hive/conf/Validator.java
##########
@@ -357,14 +357,15 @@ public String validate(String value) {
       final Path path = FileSystems.getDefault().getPath(value);
       if (path == null && value != null) {
         return String.format("Path '%s' provided could not be located.", 
value);
-      }
-      final boolean isDir = Files.isDirectory(path);
-      final boolean isWritable = Files.isWritable(path);
-      if (!isDir) {
-        return String.format("Path '%s' provided is not a directory.", value);
-      }
-      if (!isWritable) {
-        return String.format("Path '%s' provided is not writable.", value);
+      } else if (path != null) {
+        final boolean isDir = Files.isDirectory(path);
+        final boolean isWritable = Files.isWritable(path);
+        if (!isDir) {
+          return String.format("Path '%s' provided is not a directory.", 
value);
+        }
+        if (!isWritable) {
+          return String.format("Path '%s' provided is not writable.", value);
+        }
       }
       return null;

Review comment:
       Refactored the code to return early when the argument is actually null, 
the following logic is now simplified to Null and non null path




----------------------------------------------------------------
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: 456063)
    Time Spent: 1.5h  (was: 1h 20m)

> Fix FindBug issues in hive-common
> ---------------------------------
>
>                 Key: HIVE-23638
>                 URL: https://issues.apache.org/jira/browse/HIVE-23638
>             Project: Hive
>          Issue Type: Sub-task
>            Reporter: Panagiotis Garefalakis
>            Assignee: Panagiotis Garefalakis
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: spotbugsXml.xml
>
>          Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> mvn -Pspotbugs 
> -Dorg.slf4j.simpleLogger.log.org.apache.maven.plugin.surefire.SurefirePlugin=INFO
>  -pl :hive-common test-compile 
> com.github.spotbugs:spotbugs-maven-plugin:4.0.0:check



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

Reply via email to