JAL-3171 raise warning when a dataset reference exists *and* a different dataset...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 14 Dec 2018 16:34:01 +0000 (16:34 +0000)
committerJim Procter <jprocter@issues.jalview.org>
Fri, 14 Dec 2018 16:34:05 +0000 (16:34 +0000)
src/jalview/project/Jalview2XML.java

index 8c3175f..4cc43d3 100644 (file)
@@ -5221,16 +5221,19 @@ public class Jalview2XML
     jalview.datamodel.AlignmentI ds = getDatasetFor(
             vamsasSet.getDatasetId());
     Vector dseqs = null;
-    if (ds == null)
+    if (!ignoreUnrefed)
     {
-      if (!ignoreUnrefed)
+      // recovering an alignment View
+      AlignmentI seqSetDS = getDatasetFor(UNIQSEQSETID + uniqueSeqSetId);
+      if (seqSetDS != null)
       {
-        // try to resolve the dataset via uniqueSeqSetId
-        ds = getDatasetFor(UNIQSEQSETID + uniqueSeqSetId);
-        if (ds != null)
+        if (ds != null && ds != seqSetDS)
         {
-          addDatasetRef(vamsasSet.getDatasetId(), ds);
+          warn("JAL-3171 regression: Overwriting a dataset reference for an alignment"
+                  + " - CDS/Protein crossreference data may be lost");
         }
+        ds = seqSetDS;
+        addDatasetRef(vamsasSet.getDatasetId(), ds);
       }
     }
     if (ds == null)