修复idea 一些警告问题

pull/183/head
1332987 3 years ago
parent 79be99d3e1
commit b7db6f6686

@ -609,7 +609,7 @@ public class Convert {
return new BigDecimal((Long) value);
}
if (value instanceof Double) {
return new BigDecimal((Double) value);
return BigDecimal.valueOf((Double) value);
}
if (value instanceof Integer) {
return new BigDecimal((Integer) value);

@ -47,8 +47,6 @@ public class FileUtils {
while ((length = fis.read(b)) > 0) {
os.write(b, 0, length);
}
} catch (IOException e) {
throw e;
} finally {
if (os != null) {
try {

@ -23,7 +23,7 @@ public class ImageUtils {
try {
return IOUtils.toByteArray(is);
} catch (Exception e) {
log.error("图片加载异常 {}", e);
log.error("图片加载异常 ", e);
return null;
} finally {
IOUtils.closeQuietly(is);
@ -36,7 +36,7 @@ public class ImageUtils {
result = Arrays.copyOf(result, result.length);
return new ByteArrayInputStream(result);
} catch (Exception e) {
log.error("获取图片异常 {}", e);
log.error("获取图片异常 ", e);
}
return null;
}
@ -59,7 +59,7 @@ public class ImageUtils {
in = urlConnection.getInputStream();
return IOUtils.toByteArray(in);
} catch (Exception e) {
log.error("访问文件异常 {}", e);
log.error("访问文件异常 ", e);
return null;
} finally {
IOUtils.closeQuietly(in);

@ -120,7 +120,7 @@ public class EscapeUtil {
tmp.append(content.substring(lastPos));
lastPos = content.length();
} else {
tmp.append(content.substring(lastPos, pos));
tmp.append(content, lastPos, pos);
lastPos = pos;
}
}

@ -189,6 +189,7 @@ public class IpUtils {
try {
return InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return "127.0.0.1";
}
@ -202,6 +203,7 @@ public class IpUtils {
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
e.printStackTrace();
}
return "未知";
}

@ -657,7 +657,7 @@ public class ExcelUtil<T> {
addStatisticsData(column, Convert.toStr(value), attr);
}
} catch (Exception e) {
log.error("导出Excel失败{}", e);
log.error("导出Excel失败", e);
}
return cell;
}
@ -704,10 +704,11 @@ public class ExcelUtil<T> {
public String dataFormatHandlerAdapter(Object value, Excel excel) {
try {
Object instance = excel.handler().newInstance();
Method formatMethod = excel.handler().getMethod("format", new Class[]{Object.class, String[].class});
Method formatMethod = excel.handler().getMethod("format", Object.class, String[].class);
value = formatMethod.invoke(instance, value, excel.args());
} catch (Exception e) {
log.error("不能格式化数据 " + excel.handler(), e.getMessage());
log.info("不能格式化数据 {}" ,excel.handler());
log.error("不能格式化数据 " , e);
}
return Convert.toStr(value);
}
@ -724,6 +725,7 @@ public class ExcelUtil<T> {
try {
temp = Double.valueOf(text);
} catch (NumberFormatException e) {
log.error("NumberFormatException ",e);
}
statistics.put(index, statistics.get(index) + temp);
}

@ -422,9 +422,7 @@ public final class UUID implements java.io.Serializable, Comparable<UUID> {
// can simply be numerically compared as two numbers
return (this.mostSigBits < val.mostSigBits ? -1 :
(this.mostSigBits > val.mostSigBits ? 1 :
(this.leastSigBits < val.leastSigBits ? -1 :
(this.leastSigBits > val.leastSigBits ? 1 :
0))));
(Long.compare(this.leastSigBits, val.leastSigBits))));
}
/**

@ -20,8 +20,6 @@ class ServiceExceptionTest {
@Test
void testThirdTest() {
GlobalException globalException2 = new GlobalException("");
globalException2.getMessage();
globalException2.getDetailMessage();
globalException2.setDetailMessage("");
throw globalException2;
}
@ -29,12 +27,8 @@ class ServiceExceptionTest {
@Test
void testThirdTest2() {
GlobalException globalException2 = new GlobalException();
globalException2.getMessage();
globalException2.getDetailMessage();
System.out.println(globalException2.getMessage());
System.out.println(globalException2.getDetailMessage());
System.out.println(globalException2.setDetailMessage(""));
globalException2.setDetailMessage("");
throw globalException2;
throw globalException2.setDetailMessage("");
}
}

@ -147,6 +147,7 @@ public class LogAspect {
Object jsonObj = JSON.toJSON(o);
params += jsonObj.toString() + " ";
} catch (Exception e) {
e.printStackTrace();
}
}
}

@ -53,13 +53,9 @@ public class PreAuthorizeAspect {
// 注解鉴权
MethodSignature signature = (MethodSignature) joinPoint.getSignature();
checkMethodAnnotation(signature.getMethod());
try {
// 执行原有逻辑
Object obj = joinPoint.proceed();
return obj;
} catch (Throwable e) {
throw e;
}
// 执行原有逻辑
Object obj = joinPoint.proceed();
return obj;
}
/**

@ -103,6 +103,7 @@ public class TokenService {
return user;
}
} catch (Exception e) {
e.printStackTrace();
}
return user;
}

@ -10,7 +10,6 @@ import org.quartz.JobDataMap;
import org.quartz.JobKey;
import org.quartz.Scheduler;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

Loading…
Cancel
Save