From: jprocter Date: Tue, 14 Apr 2009 12:31:59 +0000 (+0000) Subject: patch to fix occasional arrayoutofbounds exception when working with hidden columns... X-Git-Tag: Jalview_2_4_0b2~38 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6af03a975707c7e69cfba8885d69186d57a4c772;p=jalview.git patch to fix occasional arrayoutofbounds exception when working with hidden columns and ragged annotation rows --- 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; }