소스 검색

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>
gabry.wu 5 년 전
부모
커밋
718e4b15d2

+ 2 - 8
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");
   }
 

+ 1 - 1
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();