From: Jim Procter Date: Tue, 21 May 2013 13:12:15 +0000 (+0100) Subject: JAL-1070 - [ not a real patch ] - include offending line number and content in output... X-Git-Tag: Jalview_2_9~249^2~21 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3a737f9769e1d0abbf973730b4f240c4abd5f475;p=jalview.git JAL-1070 - [ not a real patch ] - include offending line number and content in output when an Alignment annotation file parsing exception stacktraces to stderr --- 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)