This is an automated email from the ASF dual-hosted git repository.

lgcareer pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev by this push:
     new 1e7582e  #3176 optimize Gets the value of this property 
“resource.storage.type”, Comparison with enumerated types (#3178)
1e7582e is described below

commit 1e7582e910c23a42bb4e92cd64fde4df7cbf6b34
Author: felix-thinkingdata 
<[email protected]>
AuthorDate: Fri Jul 10 15:21:42 2020 +0800

    #3176 optimize Gets the value of this property “resource.storage.type”, 
Comparison with enumerated types (#3178)
    
    * fix bug #3165   get resource.storage.type value   toUpperCase
    
    * fix bug #3176  optimize Gets the value of this property 
“resource.storage.type”
    
    Co-authored-by: dailidong <[email protected]>
---
 .../apache/dolphinscheduler/common/utils/CommonUtils.java    |  2 +-
 .../apache/dolphinscheduler/common/utils/HadoopUtils.java    |  2 +-
 .../apache/dolphinscheduler/common/utils/PropertyUtils.java  | 12 +++++++++++-
 3 files changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java
index 2468e62..0c23d5c 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/CommonUtils.java
@@ -70,7 +70,7 @@ public class CommonUtils {
    * @return true if upload resource is HDFS and kerberos startup
    */
   public static boolean getKerberosStartupState(){
-    String resUploadStartupType = 
PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
+    String resUploadStartupType = 
PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
     ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType);
     Boolean kerberosStartupState = 
PropertyUtils.getBoolean(Constants.HADOOP_SECURITY_AUTHENTICATION_STARTUP_STATE,false);
     return resUploadType == ResUploadType.HDFS && kerberosStartupState;
diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
index 33127e1..a628c6a 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/HadoopUtils.java
@@ -110,7 +110,7 @@ public class HadoopUtils implements Closeable {
         try {
             configuration = new Configuration();
 
-            String resourceStorageType = 
PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE);
+            String resourceStorageType = 
PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
             ResUploadType resUploadType = 
ResUploadType.valueOf(resourceStorageType);
 
             if (resUploadType == ResUploadType.HDFS) {
diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
index d0c08b1..8f0ee32 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/PropertyUtils.java
@@ -72,7 +72,7 @@ public class PropertyUtils {
      * @return  judge whether resource upload startup
      */
     public static Boolean getResUploadStartupState(){
-        String resUploadStartupType = 
PropertyUtils.getString(Constants.RESOURCE_STORAGE_TYPE).toUpperCase();
+        String resUploadStartupType = 
PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
         ResUploadType resUploadType = 
ResUploadType.valueOf(resUploadStartupType);
         return resUploadType == ResUploadType.HDFS || resUploadType == 
ResUploadType.S3;
     }
@@ -88,6 +88,16 @@ public class PropertyUtils {
     }
 
     /**
+     * get property value with upper case
+     *
+     * @param key property name
+     * @return property value  with upper case
+     */
+    public static String getUpperCaseString(String key) {
+        return properties.getProperty(key.trim()).toUpperCase();
+    }
+
+    /**
      * get property value
      *
      * @param key property name

Reply via email to