File tree Expand file tree Collapse file tree 2 files changed +13
-7
lines changed
scalac-scoverage-plugin/src/main/scala/scoverage Expand file tree Collapse file tree 2 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -85,7 +85,9 @@ object Serializer {
8585 new File (dataDir, Constants .CoverageFileName )
8686
8787 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()
8991 }
9092
9193 def deserialize (lines : Iterator [String ]): Coverage = {
Original file line number Diff line number Diff line change @@ -39,12 +39,16 @@ class ScoverageHtmlWriter(
3939 val packageFile = new File (outputDir.getAbsolutePath + " /packages.html" )
4040 val overviewFile = new File (outputDir.getAbsolutePath + " /overview.html" )
4141
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+ }
4852 IOUtils .writeToFile(indexFile, index)
4953 IOUtils .writeToFile(cssFile, css)
5054 IOUtils .writeToFile(packageFile, packageList(coverage).toString())
You can’t perform that action at this time.
0 commit comments