summaryrefslogtreecommitdiff
path: root/src/library
diff options
context:
space:
mode:
authorGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-05-01 12:45:55 +0000
committerGeoffrey Washburn <geoffrey.washburn@epfl.ch>2008-05-01 12:45:55 +0000
commite5a1fb508d855a0b6891b40095f75f92703987a1 (patch)
tree18307bb432722617255251ed1cb17ff62a276054 /src/library
parent3e1e2078f7785292dd99566fcfc5d7d8264b7013 (diff)
downloadscala-e5a1fb508d855a0b6891b40095f75f92703987a1.tar.gz
scala-e5a1fb508d855a0b6891b40095f75f92703987a1.tar.bz2
scala-e5a1fb508d855a0b6891b40095f75f92703987a1.zip
Console.readLine() now throws EOFException inst...
Console.readLine() now throws EOFException instead of returning null.
Diffstat (limited to 'src/library')
-rw-r--r--src/library/scala/Console.scala10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/library/scala/Console.scala b/src/library/scala/Console.scala
index 519fab403d..204d7d7c35 100644
--- a/src/library/scala/Console.scala
+++ b/src/library/scala/Console.scala
@@ -186,12 +186,16 @@ object Console {
out.printf(text, args.asInstanceOf[scala.runtime.BoxedObjectArray].
unbox(args.getClass).asInstanceOf[Array[Object]])
- /** Read a full line from the terminal. Returns null if the end of the
+ /** Read a full line from the terminal. Throws EOFException if the end of the
* input stream has been reached.
*
- * @return the string read from the terminal.
+ * @return the string read from the terminal.
+ * @throws java.io.EOFException
*/
- def readLine(): String = in.readLine()
+ def readLine(): String = {
+ val s = in.readLine()
+ if (s == null) throw new java.io.EOFException("Console has reached end of input") else s
+ }
/** Print a formatted text and read a full line from the terminal.
* Returns null if the end of the input stream has been reached.