From 1b4069135fa518efcb11d9cb729e5031347b8fe0 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Wed, 28 Sep 2016 15:25:29 +0100 Subject: [PATCH] JAL-2235 raise exceptions if self reference or reference to non-ds sequence is passed to setDatasetSequence --- src/jalview/datamodel/Sequence.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) 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; } -- 1.7.10.2