Browse Source

Adapting partial code(file name start with O) to the sonar cloud rule (#2259)

* Adapting partial code(file name start with O) to the sonar cloud rule

* resolve conflict with dev branch

Co-authored-by: dailidong <dailidong66@gmail.com>
pull/2/head
gabry.wu 4 years ago committed by GitHub
parent
commit
718e4b15d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
  2. 2
      dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java

10
dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java

@ -352,13 +352,7 @@ public class OSUtils {
return sb.toString();
} finally {
if (br != null) {
try {
br.close();
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
}
IOUtils.closeQuietly(br);
}
}
@ -408,7 +402,7 @@ public class OSUtils {
* whether is windows
* @return true if windows
*/
public static boolean isWindows() { ;
public static boolean isWindows() {
return getOSName().startsWith("Windows");
}

2
dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java

@ -67,7 +67,7 @@ public class OSUtilsTest {
@Test
public void cpuUsage() throws Exception {
logger.info("cpuUsage : {}", OSUtils.cpuUsage());
Thread.sleep(1000l);
Thread.sleep(1000L);
logger.info("cpuUsage : {}", OSUtils.cpuUsage());
double cpuUsage = OSUtils.cpuUsage();

Loading…
Cancel
Save