File tree Expand file tree Collapse file tree 6 files changed +63
-0
lines changed
java/ql/test/kotlin/query-tests Expand file tree Collapse file tree 6 files changed +63
-0
lines changed Original file line number Diff line number Diff line change
1
+ | CloseReader.kt:4:20:4:45 | new FileReader(...) | This FileReader is not always closed on method exit. |
Original file line number Diff line number Diff line change
1
+ import java.io.*
2
+
3
+ fun test0 () {
4
+ BufferedReader (FileReader (" C:\\ test.txt" )).use { bw ->
5
+ bw.readLine()
6
+ }
7
+ }
Original file line number Diff line number Diff line change
1
+ Likely Bugs/Resource Leaks/CloseReader.ql
Original file line number Diff line number Diff line change
1
+ | CloseWriter.kt:4:29:4:54 | new FileWriter(...) | This FileWriter is not always closed on method exit. |
2
+ | CloseWriter.kt:9:20:9:45 | new FileWriter(...) | This FileWriter is not always closed on method exit. |
3
+ | CloseWriter.kt:15:14:15:57 | new FileOutputStream(...) | This FileOutputStream is not always closed on method exit. |
4
+ | CloseWriter.kt:20:5:20:48 | new FileOutputStream(...) | This FileOutputStream is not always closed on method exit. |
5
+ | CloseWriter.kt:26:33:26:76 | new FileOutputStream(...) | This FileOutputStream is not always closed on method exit. |
6
+ | CloseWriter.kt:31:24:31:67 | new FileOutputStream(...) | This FileOutputStream is not always closed on method exit. |
7
+ | CloseWriter.kt:37:33:37:76 | new FileOutputStream(...) | This FileOutputStream is not always closed on method exit. |
8
+ | CloseWriter.kt:42:24:42:67 | new FileOutputStream(...) | This FileOutputStream is not always closed on method exit. |
Original file line number Diff line number Diff line change
1
+ import java.io.*
2
+
3
+ fun test0 () {
4
+ val bw = BufferedWriter (FileWriter (" C:\\ test.txt" ))
5
+ bw.write(" test" )
6
+ }
7
+
8
+ fun test1 () {
9
+ BufferedWriter (FileWriter (" C:\\ test.txt" )).use { bw ->
10
+ bw.write(" test" )
11
+ }
12
+ }
13
+
14
+ fun test2 () {
15
+ val bw = FileOutputStream (File .createTempFile(" " ," " )).bufferedWriter()
16
+ bw.write(" test" )
17
+ }
18
+
19
+ fun test3 () {
20
+ FileOutputStream (File .createTempFile(" " ," " )).bufferedWriter().use { bw ->
21
+ bw.write(" test" )
22
+ }
23
+ }
24
+
25
+ fun test4 () {
26
+ val bw = OutputStreamWriter (FileOutputStream (File .createTempFile(" " ," " ))).buffered()
27
+ bw.write(" test" )
28
+ }
29
+
30
+ fun test5 () {
31
+ OutputStreamWriter (FileOutputStream (File .createTempFile(" " ," " ))).buffered().use { bw ->
32
+ bw.write(" test" )
33
+ }
34
+ }
35
+
36
+ fun test6 () {
37
+ val bw = OutputStreamWriter (FileOutputStream (File .createTempFile(" " ," " )))
38
+ bw.write(" test" )
39
+ }
40
+
41
+ fun test7 () {
42
+ OutputStreamWriter (FileOutputStream (File .createTempFile(" " ," " ))).use { bw ->
43
+ bw.write(" test" )
44
+ }
45
+ }
Original file line number Diff line number Diff line change
1
+ Likely Bugs/Resource Leaks/CloseWriter.ql
You can’t perform that action at this time.
0 commit comments