From 4f8cf43cfb67fbc5ca94047b15004adb1a367dea Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 25 Mar 2022 14:30:17 +0000 Subject: [PATCH] JAL-3980 defensive copy - inefficient but fixes bug --- src/jalview/io/SequenceAnnotationReport.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/jalview/io/SequenceAnnotationReport.java b/src/jalview/io/SequenceAnnotationReport.java index b0b0dee..7fc04e1 100644 --- a/src/jalview/io/SequenceAnnotationReport.java +++ b/src/jalview/io/SequenceAnnotationReport.java @@ -21,13 +21,16 @@ package jalview.io; import java.util.Locale; - +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import com.google.common.collect.Lists; + import jalview.api.FeatureColourI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; @@ -536,12 +539,19 @@ public class SequenceAnnotationReport protected int appendDbRefs(final StringBuilder sb, SequenceI ds, boolean summary) { - List dbrefs = ds.getDBRefs(); - if (dbrefs == null) + List dbrefs,dbrefset = ds.getDBRefs(); + + if (dbrefset == null) { return 0; } + // PATCH for JAL-3980 defensive copy + + dbrefs = new ArrayList(); + + dbrefs.addAll(dbrefset); + // note this sorts the refs held on the sequence! dbrefs.sort(comparator); boolean ellipsis = false; -- 1.7.10.2