You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2019/11/07 08:50:30 UTC

[GitHub] [incubator-doris] kangpinghuang commented on a change in pull request #2148: Support hdfs broker reading config from hdfs-site.xml

kangpinghuang commented on a change in pull request #2148: Support hdfs broker reading config from hdfs-site.xml
URL: https://github.com/apache/incubator-doris/pull/2148#discussion_r343532783
 
 

 ##########
 File path: fs_brokers/apache_hdfs_broker/src/main/java/org/apache/doris/broker/hdfs/FileSystemManager.java
 ##########
 @@ -140,22 +142,17 @@ public BrokerFileSystem getFileSystem(String path, Map<String, String> propertie
                         "invalid hdfs path. authority is null");
             }
         }
-        String username = properties.containsKey(USER_NAME_KEY) ? properties.get(USER_NAME_KEY) : "";
-        String password = properties.containsKey(PASSWORD_KEY) ? properties.get(PASSWORD_KEY) : "";
-        String dfsNameServices =
-                properties.containsKey(DFS_NAMESERVICES_KEY) ? properties.get(DFS_NAMESERVICES_KEY) : "";
-        String authentication = AUTHENTICATION_SIMPLE;
-        if (properties.containsKey(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION)) {
-            authentication = properties.get(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION);
-            if (Strings.isNullOrEmpty(authentication)
-                    || (!authentication.equals(AUTHENTICATION_SIMPLE)
-                    && !authentication.equals(AUTHENTICATION_KERBEROS))) {
-                logger.warn("invalid authentication:" + authentication);
-                throw  new BrokerException(TBrokerOperationStatusCode.INVALID_ARGUMENT,
-                        "invalid authentication:" + authentication);
-            }
+        String username = properties.getOrDefault(USER_NAME_KEY, "");
+        String password = properties.getOrDefault(PASSWORD_KEY, "");
+        String dfsNameServices = properties.getOrDefault(DFS_NAMESERVICES_KEY, "");
+        String authentication = properties.getOrDefault(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION,
+            AUTHENTICATION_SIMPLE);
+        if (Strings.isNullOrEmpty(authentication) || (!authentication.equals(AUTHENTICATION_SIMPLE)
+            && !authentication.equals(AUTHENTICATION_KERBEROS))) {
+            logger.warn("invalid authentication:" + authentication);
+            throw  new BrokerException(TBrokerOperationStatusCode.INVALID_ARGUMENT,
 
 Review comment:
   ```suggestion
               throw new BrokerException(TBrokerOperationStatusCode.INVALID_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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org