Browse Source

Simplify some methods for easy understanding (#2920)

Co-authored-by: gabry.wu <8545796+gabrywu@users.noreply.github.com>
pull/2/MERGE
CalvinKirs 4 years ago committed by GitHub
parent
commit
518d03b6a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/DependentUtils.java
  2. 11
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IpUtils.java
  3. 10
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/SchemaUtils.java

4
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:

11
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;
}
}

10
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;
}

Loading…
Cancel
Save