This is an automated email from the ASF dual-hosted git repository.
journey 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 93aa160 Adapting partial code(file name start with I) to the sonar
cloud rule (#2155)
93aa160 is described below
commit 93aa160698a584bbcb8cdb45953efe1cc2b78915
Author: gabry.wu <[email protected]>
AuthorDate: Fri Mar 13 13:02:51 2020 +0800
Adapting partial code(file name start with I) to the sonar cloud rule
(#2155)
---
.../apache/dolphinscheduler/common/utils/IOUtils.java | 19 +++++--------------
.../apache/dolphinscheduler/common/utils/IpUtils.java | 5 -----
.../dolphinscheduler/common/utils/IpUtilsTest.java | 6 +++---
3 files changed, 8 insertions(+), 22 deletions(-)
diff --git
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IOUtils.java
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IOUtils.java
index 73df158..ce551d8 100644
---
a/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IOUtils.java
+++
b/dolphinscheduler-common/src/main/java/org/apache/dolphinscheduler/common/utils/IOUtils.java
@@ -19,26 +19,17 @@
package org.apache.dolphinscheduler.common.utils;
+import java.io.Closeable;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
public class IOUtils {
- public static void closeQuietly(InputStream fis){
- if(fis != null){
+ public static void closeQuietly(Closeable closeable){
+ if(closeable != null){
try {
- fis.close();
- } catch (IOException ignore) {
- }
- }
- }
-
- public static void closeQuietly(InputStreamReader reader){
- if(reader != null){
- try {
- reader.close();
+ closeable.close();
} catch (IOException ignore) {
+ // nothing need to do
}
}
}
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 e7e0b34..3b068c6 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
@@ -17,16 +17,11 @@
package org.apache.dolphinscheduler.common.utils;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
/**
* http utils
*/
public class IpUtils {
- private static final Logger logger = LoggerFactory.getLogger(IpUtils.class);
public static final String DOT = ".";
/**
diff --git
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/IpUtilsTest.java
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/IpUtilsTest.java
index e65bcd2..ec6ffa3 100644
---
a/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/IpUtilsTest.java
+++
b/dolphinscheduler-common/src/test/java/org/apache/dolphinscheduler/common/utils/IpUtilsTest.java
@@ -29,13 +29,13 @@ public class IpUtilsTest {
long longNumber = IpUtils.ipToLong(ip);
long longNumber2 = IpUtils.ipToLong(ip2);
System.out.println(longNumber);
- Assert.assertEquals(longNumber, 3232263681L);
- Assert.assertEquals(longNumber2, 0L);
+ Assert.assertEquals(3232263681L, longNumber);
+ Assert.assertEquals(0L, longNumber2);
String ip3 = "255.255.255.255";
long longNumber3 = IpUtils.ipToLong(ip3);
System.out.println(longNumber3);
- Assert.assertEquals(longNumber3, 4294967295L);
+ Assert.assertEquals(4294967295L, longNumber3);
}