The following java code should create a sonar warning of “Resources should be closed (squid:S2095)”
Because FileInputStream (resource) in created and not closed in code
public static String getMD5Checksum(String filePath) throws Exception {
File file = new File(filePath);
FileInputStream fis = new FileInputStream(file);
return DigestUtils.md5Hex(fis);
}
Notice that if we add fis.read();
it warns OK