-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Description
Hi, the following code example contains a false negative bug. Infer failed to report a PULSE_RESOURCE_LEAK
warning at line 10, where an InputStream
resource is not closed after use. The infer version is v1.2.0.
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Optional;
public class Main {
void foo(boolean b) throws IOException, FileNotFoundException {
Optional<FileInputStream> stream;
if (b) {
stream = Optional.of(new FileInputStream("file.txt")); // should report a warning at this line
}
}
}
Log
infer run -- javac Main.java
Capturing in javac mode...
Found 1 source file to analyze in /infer-out
0/3 [................................................................................] 0% 120ms
⊢ [ 0.1s][17.8M] Main.java: Main.<init>()
⊢ [ 0.1s][17.8M] Main.java: void Main.foo(boolean)
3/3 [################################################################################] 100% 170ms
⊢ [ 0.0s][17.8M] idle
⊢ [ 0.0s][17.8M] idle
⊢ [ 0.0s][17.8M] idle
No issues found
Metadata
Metadata
Assignees
Labels
No labels