From: Jim Procter Date: Tue, 5 Apr 2016 17:14:42 +0000 (+0100) Subject: JAL-2046 explicitly copy char[] when cloning sequence data for copy-constructor/deriv... X-Git-Tag: Release_2_10_0~249^2~31^2~11 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=52fca080c3cb048defbe2d3a6f44fff760365b51;p=jalview.git JAL-2046 explicitly copy char[] when cloning sequence data for copy-constructor/deriveSequence
 --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 6f1b403..cb3ae70 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -25,6 +25,7 @@ import jalview.api.DBRefEntryI; import jalview.util.StringUtils; import java.util.ArrayList; +import java.util.Arrays; import java.util.Enumeration; import java.util.List; import java.util.Vector; @@ -216,8 +217,12 @@ public class Sequence extends ASequence implements SequenceI protected void initSeqFrom(SequenceI seq, AlignmentAnnotation[] alAnnotation) { - initSeqAndName(seq.getName(), seq.getSequence(), seq.getStart(), + { + char[] oseq = seq.getSequence(); + initSeqAndName(seq.getName(), Arrays.copyOf(oseq, oseq.length), + seq.getStart(), seq.getEnd()); + } description = seq.getDescription(); sourceDBRef = seq.getSourceDBRef() == null ? null : new DBRefEntry( seq.getSourceDBRef());