sonarqube: Is try-with-resources or close this "ObjectInputStream" in a "finally" clause for below code false positive?

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){… Read More sonarqube: Is try-with-resources or close this "ObjectInputStream" in a "finally" clause for below code false positive?

Sonar scan says Use try-with-resources or close this "Stream" in a "finally" clause

Sonar qube is giving me the following error. Use try-with-resources or close this "Stream" in a "finally" clause. this is my code. Path start = Paths.get(filePath); Stream<File> stream; try { stream = Files.walk(start, 1, FileVisitOption.FOLLOW_LINKS).map(s -> s.toFile()); List<File> files = stream.collect(Collectors.toList()); files.remove(0); for (File f : files) { String fileName = f.toPath().getFileName().toString(); if (fileName.matches(regex)) {… Read More Sonar scan says Use try-with-resources or close this "Stream" in a "finally" clause