You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by li...@apache.org on 2020/03/31 04:13:45 UTC
[incubator-dolphinscheduler] branch dev updated: Adapting partial
code(file name start with O) to the sonar cloud rule (#2259)
This is an automated email from the ASF dual-hosted git repository.
lidongdai 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 718e4b1 Adapting partial code(file name start with O) to the sonar cloud rule (#2259)
718e4b1 is described below
commit 718e4b15d2484f7d94d96b8110025a0fa07d86c4
Author: gabry.wu <wu...@qq.com>
AuthorDate: Tue Mar 31 12:13:34 2020 +0800
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 <da...@gmail.com>
---
.../java/org/apache/dolphinscheduler/common/utils/OSUtils.java | 10 ++--------
.../org/apache/dolphinscheduler/common/os/OSUtilsTest.java | 2 +-
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
index a0fea8d..4df09d1 100644
--- a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/OSUtils.java
+++ b/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");
}
diff --git a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java
index 2670eeb..1815e48 100644
--- a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/os/OSUtilsTest.java
+++ b/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();