From 6af03a975707c7e69cfba8885d69186d57a4c772 Mon Sep 17 00:00:00 2001 From: jprocter Date: Tue, 14 Apr 2009 12:31:59 +0000 Subject: [PATCH] patch to fix occasional arrayoutofbounds exception when working with hidden columns and ragged annotation rows --- src/jalview/datamodel/ColumnSelection.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java index ca54570..9dbaced 100644 --- a/src/jalview/datamodel/ColumnSelection.java +++ b/src/jalview/datamodel/ColumnSelection.java @@ -998,15 +998,17 @@ public class ColumnSelection if (end > blockStart) { annels.addElement(els = new Annotation[end - blockStart + 1]); - if (end - blockStart + 1 <= alignmentAnnotation.annotations.length) + if ((els.length+blockStart)<= alignmentAnnotation.annotations.length) { + // copy just the visible segment of the annotation row System.arraycopy(alignmentAnnotation.annotations, blockStart, els, 0, els.length); } else { + // copy to the end of the annotation row System.arraycopy(alignmentAnnotation.annotations, blockStart, - els, 0, (end - blockStart + 1)); + els, 0, (alignmentAnnotation.annotations.length - blockStart)); } w += els.length; } -- 1.7.10.2