mirror of
https://gitee.com/dolphinscheduler/DolphinScheduler.git
synced 2024-12-01 19:58:29 +08:00
Adapting partial code(file name start with I) to the sonar cloud rule (#2155)
This commit is contained in:
parent
455d8c7a7c
commit
93aa160698
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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 = ".";
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user