From: Jim Procter Date: Wed, 28 Sep 2016 14:25:29 +0000 (+0100) Subject: JAL-2235 raise exceptions if self reference or reference to non-ds sequence is passed... X-Git-Tag: Release_2_10_0~20^2~29 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1b4069135fa518efcb11d9cb729e5031347b8fe0;p=jalview.git JAL-2235 raise exceptions if self reference or reference to non-ds sequence is passed to setDatasetSequence --- diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index d295480..29d114d 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -1011,7 +1011,16 @@ public class Sequence extends ASequence implements SequenceI @Override public void setDatasetSequence(SequenceI seq) { - // TODO check for circular reference before setting? + if (seq == this) + { + throw new Error( + "Implementation Error: self reference passed to SequenceI.setDatasetSequence"); + } + if (seq != null && seq.getDatasetSequence() != null) + { + throw new Error( + "Implementation error: cascading dataset sequences are not allowed."); + } datasetSequence = seq; }