For the below java code though resource is closed in a finally block sonar is reporting:Use try-with-resources or close this “ObjectInputStream” in a “finally” clause.
FileInputStream fileInputStream = null;
ObjectInputStream objIn = null;
try {
fileInputStream = new FileInputStream(value);
objIn = new ObjectInputStream(fileInputStream)
}
finally {
try{
if(fileInputStream != null){
fileInputStream.close();
}
if(objIn != null){
objIn.close();
}
}catch (IOException e){}
}