summaryrefslogtreecommitdiff
path: root/src/compiler
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-31 18:40:38 +0000
committerPaul Phillips <paulp@improving.org>2011-05-31 18:40:38 +0000
commited87ab5299ed3e19481ad14b1ab18d676c7c4a91 (patch)
tree901aa2e398117ed9ee696f6565186cb85c8668e8 /src/compiler
parentfb061f22d4c35df626d9651e017820a11f8fe56e (diff)
downloadscala-ed87ab5299ed3e19481ad14b1ab18d676c7c4a91.tar.gz
scala-ed87ab5299ed3e19481ad14b1ab18d676c7c4a91.tar.bz2
scala-ed87ab5299ed3e19481ad14b1ab18d676c7c4a91.zip
Fixed a repl history issue where some control c...
Fixed a repl history issue where some control chars sneaking in would render the entire history invisible. No review.
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
index 5f11a0ea8f..d33658b6cd 100644
--- a/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/session/FileBackedHistory.scala
@@ -46,9 +46,17 @@ trait FileBackedHistory extends JLineHistory with JPersistentHistory {
if (!historyFile.canRead)
historyFile.createFile()
- val lines: IndexedSeq[String] =
+ val lines: IndexedSeq[String] = {
try historyFile.lines().toIndexedSeq
- catch { case _: Exception => Vector() }
+ catch {
+ // It seems that control characters in the history file combined
+ // with the default codec can lead to nio spewing exceptions. Rather
+ // than abandon hope we'll try to read it as ISO-8859-1
+ case _: Exception =>
+ try historyFile.lines("ISO-8859-1").toIndexedSeq
+ catch { case _: Exception => Vector() }
+ }
+ }
repldbg("Loading " + lines.size + " into history.")