From: jprocter Date: Tue, 14 Apr 2009 12:32:14 +0000 (+0000) Subject: patch to fix occasional arrayoutofbounds exception when working with hidden columns... X-Git-Tag: Release_2_5~318 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=eb5197242ba17fcff4ce0e18419ca81a63418f7a;hp=aa25fa143274ada02f7dfe5209864ff1231b8e65;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; }