summaryrefslogtreecommitdiff
path: root/src/jvm14-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/jvm14-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/jvm14-library')
-rw-r--r--src/jvm14-library/scala/Console.scala11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/jvm14-library/scala/Console.scala b/src/jvm14-library/scala/Console.scala
index fe29150caa..0562ec8de1 100644
--- a/src/jvm14-library/scala/Console.scala
+++ b/src/jvm14-library/scala/Console.scala
@@ -187,11 +187,16 @@ object Console {
else MessageFormat.format(text, textParams(args))
)
- /** Read a full line from the terminal.
+ /** 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
*