From 3a737f9769e1d0abbf973730b4f240c4abd5f475 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 21 May 2013 14:12:15 +0100 Subject: [PATCH] JAL-1070 - [ not a real patch ] - include offending line number and content in output when an Alignment annotation file parsing exception stacktraces to stderr --- src/jalview/io/AnnotationFile.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 45e6c47..a94bd3c 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -579,14 +579,19 @@ public class AnnotationFile { ex.printStackTrace(); System.out.println("Problem reading annotation file: " + ex); + if (nlinesread>0) { + System.out.println("Last read line "+nlinesread+": '"+lastread+"' (first 80 chars) ..."); + } return false; } return false; } - + long nlinesread=0; + String lastread=""; public boolean parseAnnotationFrom(AlignmentI al, BufferedReader in) throws Exception { + nlinesread = 0; boolean modified = false; String groupRef = null; Hashtable groupRefRows = new Hashtable(); @@ -631,6 +636,7 @@ public class AnnotationFile boolean jvAnnotationFile = false; while ((line = in.readLine()) != null) { + nlinesread++;lastread = new String(line); if (line.indexOf("#") == 0) { continue; @@ -651,6 +657,7 @@ public class AnnotationFile while ((line = in.readLine()) != null) { + nlinesread++;lastread = new String(line); if (line.indexOf("#") == 0 || line.indexOf("JALVIEW_ANNOTATION") > -1 || line.length() == 0) -- 1.7.10.2