Permalink
Browse files

Merge branch 'master' of github.com:boundary/scalang

* 'master' of github.com:boundary/scalang:
  Close the streams
  • Loading branch information...
2 parents 0d5fe04 + ead0dff commit 939f48f796d384e9348a3af529ae7d04f806a795 @d2fn d2fn committed Mar 20, 2012
Showing with 8 additions and 5 deletions.
  1. +8 −5 src/main/scala/scalang/Node.scala
@@ -88,15 +88,18 @@ object Node {
protected def readFile(file : File) : String = {
val in = new BufferedReader(new FileReader(file))
- val cookie = in.readLine
- in.close
- cookie
+ try
+ in.readLine
+ finally
+ in.close
}
protected def writeCookie(file : File, cookie : String) {
val out = new FileWriter(file)
- out.write(cookie)
- out.close
+ try
+ out.write(cookie)
+ finally
+ out.close
}
}

0 comments on commit 939f48f

Please sign in to comment.