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

gabrywu 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 518d03b  Simplify some methods for easy understanding (#2920)
518d03b is described below

commit 518d03b6a60cdd814dc270f7584718be2b3ad2a3
Author: CalvinKirs <[email protected]>
AuthorDate: Sun Jun 21 15:48:35 2020 +0800

    Simplify some methods for easy understanding (#2920)
    
    
    Co-authored-by: gabry.wu <[email protected]>
---
 .../apache/dolphinscheduler/common/utils/DependentUtils.java  |  4 +---
 .../org/apache/dolphinscheduler/common/utils/IpUtils.java     | 11 +++++------
 .../org/apache/dolphinscheduler/common/utils/SchemaUtils.java | 10 +++-------
 3 files changed, 9 insertions(+), 16 deletions(-)

diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
index 40a91ac..edde12b 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
@@ -40,10 +40,8 @@ public class DependentUtils {
             case AND:
                 if(dependResultList.contains(DependResult.FAILED)){
                     dependResult = DependResult.FAILED;
-                }else if(dependResultList.contains(DependResult.WAITING)){
+                } if(dependResultList.contains(DependResult.WAITING)){
                     dependResult = DependResult.WAITING;
-                }else{
-                    dependResult = DependResult.SUCCESS;
                 }
                 break;
             case OR:
diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IpUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IpUtils.java
index 3b068c6..858e5b4 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IpUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IpUtils.java
@@ -49,12 +49,11 @@ public class IpUtils {
     ipNumbers[2] = ipLong >> 8 & tmp;
     ipNumbers[3] = ipLong & tmp;
 
-    StringBuilder sb = new StringBuilder(16);
-    sb.append(ipNumbers[0]).append(DOT)
-            .append(ipNumbers[1]).append(DOT)
-            .append(ipNumbers[2]).append(DOT)
-            .append(ipNumbers[3]);
-    return sb.toString();
+    String sb = ipNumbers[0] + DOT +
+            ipNumbers[1] + DOT +
+            ipNumbers[2] + DOT +
+            ipNumbers[3];
+    return sb;
   }
 
 }
diff --git 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java
 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java
index 7d341f3..312421a 100644
--- 
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java
+++ 
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java
@@ -22,7 +22,6 @@ import org.slf4j.LoggerFactory;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
@@ -96,11 +95,11 @@ public class SchemaUtils {
 
                String[] schemaVersionArr = schemaVersion.split("\\.");
                String[] versionArr = version.split("\\.");
-               int arrLength = schemaVersionArr.length < versionArr.length ? 
schemaVersionArr.length : versionArr.length;
+               int arrLength = Math.min(schemaVersionArr.length, 
versionArr.length);
                for(int i = 0 ; i < arrLength ; i++) {
-                       if(Integer.valueOf(schemaVersionArr[i]) > 
Integer.valueOf(versionArr[i])) {
+                       if(Integer.parseInt(schemaVersionArr[i]) > 
Integer.parseInt(versionArr[i])) {
                                return true;
-                       }else if(Integer.valueOf(schemaVersionArr[i]) < 
Integer.valueOf(versionArr[i])) {
+                       }else if(Integer.parseInt(schemaVersionArr[i]) < 
Integer.parseInt(versionArr[i])) {
                                return false;
                        }
                }
@@ -121,9 +120,6 @@ public class SchemaUtils {
                } catch (FileNotFoundException e) {
                        logger.error(e.getMessage(),e);
                        throw new RuntimeException("Failed to get the product 
version description file. The file could not be found", e);
-               } catch (IOException e) {
-                       logger.error(e.getMessage(),e);
-                       throw new RuntimeException("Failed to get product 
version number description file, failed to read the file", e);
                }
                return soft_version;
        }

Reply via email to