sonar代码扫描bug:Use try-with

下面代码
/**
* 读取文件到byte数组
*
* @param tradeFile
* @return
*/
public static byte[] file2byte(File tradeFile) {
try {
FileInputStream fis = new FileInputStream(tradeFile);
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[1024];
int n;
while ((n = fis.read(b)) != -1) {
bos.write(b, 0, n);
}
fis.close();
bos.close();
byte[] buffer = bos.toByteArray();
return buffer;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}


