diff --git a/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala b/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala index 62edd70..f9a3e84 100644 --- a/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala +++ b/src/main/scala/uk/org/floop/sparqlTestRunner/Run.scala @@ -204,15 +204,16 @@ .substring(0, relativePath.lastIndexOf('.')) .replace(File.pathSeparatorChar, '.') val comment = { - val queryLines = Using(Source.fromFile(f))(_.getLines()).get - if (queryLines.hasNext) { - val line = queryLines.next() - if (line.startsWith("# ")) - line.substring(2) - else - line - } else - className + Using.resource(Source.fromFile(f)) { src => + src.getLines().nextOption() match { + case Some(line) => + if (line.startsWith("# ")) + line.substring(2) + else + className + case None => className + } + } } tests += 1 val rawQuery = new String(Files.readAllBytes(f.toPath), StandardCharsets.UTF_8) @@ -280,7 +281,12 @@ testCases = testCases ++ - + {PCData({ + val sw = new StringWriter() + val pw = new PrintWriter(sw) + e.printStackTrace(pw) + sw.toString + })} errors += 1 }