From 668ae8d8b1c61fcd93ed20331c2d84d891129879 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 27 Jan 2014 19:41:04 +0100 Subject: [PATCH 1/2] Fix typo in assertion message in TextAnalysisFormat Add missing string interpolation indicator in assertion message. --- .../persist/src/main/scala/sbt/inc/TextAnalysisFormat.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compile/persist/src/main/scala/sbt/inc/TextAnalysisFormat.scala b/compile/persist/src/main/scala/sbt/inc/TextAnalysisFormat.scala index a23a87725..3bd28190c 100644 --- a/compile/persist/src/main/scala/sbt/inc/TextAnalysisFormat.scala +++ b/compile/persist/src/main/scala/sbt/inc/TextAnalysisFormat.scala @@ -225,8 +225,8 @@ object TextAnalysisFormat { if (nameHashing) Relations.make(srcProd, binaryDep, memberRefSrcDeps, inheritanceSrcDeps, classes, names) else { - assert(names.all.isEmpty, s"When `nameHashing` is disabled `names` relation " + - "should be empty: $names") + assert(names.all.isEmpty, "When `nameHashing` is disabled `names` relation " + + s"should be empty: $names") Relations.make(srcProd, binaryDep, directSrcDeps, publicInheritedSrcDeps, classes) } } From bb8dd21620d9a8a35c6d1a4a4070d5279e1c2950 Mon Sep 17 00:00:00 2001 From: Grzegorz Kossakowski Date: Mon, 27 Jan 2014 19:48:13 +0100 Subject: [PATCH 2/2] Record the name of an Analysis file in case of a read failure. Catch ReadException and wrap it in IOException that carries the name of the file we failed to read in its message. We have to catch exception and wrap them because in TextAnalysisFormat we don't have an access to the file name (it operates using an abstract reader). --- .../main/scala/sbt/compiler/IncrementalCompiler.scala | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/compile/integration/src/main/scala/sbt/compiler/IncrementalCompiler.scala b/compile/integration/src/main/scala/sbt/compiler/IncrementalCompiler.scala index 68ad63f2c..5028c7996 100644 --- a/compile/integration/src/main/scala/sbt/compiler/IncrementalCompiler.scala +++ b/compile/integration/src/main/scala/sbt/compiler/IncrementalCompiler.scala @@ -46,5 +46,12 @@ object IC extends IncrementalCompiler[Analysis, AnalyzingCompiler] } def readCacheUncaught(file: File): (Analysis, CompileSetup) = - Using.fileReader(IO.utf8)(file) { reader => TextAnalysisFormat.read(reader) } + Using.fileReader(IO.utf8)(file) { reader => + try { + TextAnalysisFormat.read(reader) + } catch { + case ex: sbt.inc.ReadException => + throw new java.io.IOException(s"Error while reading $file", ex) + } + } }