Sonar:修复Use try-with-resources or close this “xxx” in a “finally” clause
问题描述
Use try-with-resources or close this "xxx" in a "finally" clause
问题不通过代码位置
try {
Data da = new Datat("");
Dataa dd = new Dataa();
dd.send(da);
dd.close();
} catch (Exception e) {
e.printStackTrace();
}
解决方法:
try(Dataa dd = new Dataa()) {
Data da = new Datat("");
dd.send(da);
} catch (Exception e) {
e.printStackTrace();
}