File tree 2 files changed +13
-7
lines changed
scalac-scoverage-plugin/src/main/scala/scoverage
2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ object Serializer {
85
85
new File (dataDir, Constants .CoverageFileName )
86
86
87
87
def deserialize (file : File ): Coverage = {
88
- deserialize(Source .fromFile(file)(Codec .UTF8 ).getLines())
88
+ val source = Source .fromFile(file)(Codec .UTF8 )
89
+ try deserialize(source.getLines())
90
+ finally source.close()
89
91
}
90
92
91
93
def deserialize (lines : Iterator [String ]): Coverage = {
Original file line number Diff line number Diff line change @@ -39,12 +39,16 @@ class ScoverageHtmlWriter(
39
39
val packageFile = new File (outputDir.getAbsolutePath + " /packages.html" )
40
40
val overviewFile = new File (outputDir.getAbsolutePath + " /overview.html" )
41
41
42
- val index = IOUtils .readStreamAsString(
43
- getClass.getResourceAsStream(" /scoverage/index.html" )
44
- )
45
- val css = IOUtils .readStreamAsString(
46
- getClass.getResourceAsStream(" /scoverage/pure-min.css" )
47
- )
42
+ val index = {
43
+ val in = getClass.getResourceAsStream(" /scoverage/index.html" )
44
+ try IOUtils .readStreamAsString(in)
45
+ finally in.close()
46
+ }
47
+ val css = {
48
+ val in = getClass.getResourceAsStream(" /scoverage/pure-min.css" )
49
+ try IOUtils .readStreamAsString(in)
50
+ finally in.close()
51
+ }
48
52
IOUtils .writeToFile(indexFile, index)
49
53
IOUtils .writeToFile(cssFile, css)
50
54
IOUtils .writeToFile(packageFile, packageList(coverage).toString())
You can’t perform that action at this time.
0 commit comments