From 1bc0cc2cbaf2e782e6b38cb8c82a9c4df0001db1 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 8 Dec 2017 15:10:59 +0000 Subject: [PATCH] JAL-2843 FeatureRenderer.getFeatureFilters returns the map, not a copy --- src/jalview/api/FeatureRenderer.java | 2 +- src/jalview/gui/FeatureSettings.java | 3 ++- src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/jalview/api/FeatureRenderer.java b/src/jalview/api/FeatureRenderer.java index ead84fa..cf3c8da 100644 --- a/src/jalview/api/FeatureRenderer.java +++ b/src/jalview/api/FeatureRenderer.java @@ -226,7 +226,7 @@ public interface FeatureRenderer FeatureMatcherSetI getFeatureFilter(String featureType); /** - * Answers a shallow copy of the feature filters map + * Answers the feature filters map * * @return */ diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 4b4f363..5fc00a3 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -66,6 +66,7 @@ import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintWriter; import java.util.Arrays; +import java.util.HashMap; import java.util.HashSet; import java.util.Hashtable; import java.util.Iterator; @@ -191,7 +192,7 @@ public class FeatureSettings extends JPanel int originalTransparencyAsPercent = (int) (originalTransparency * 100); transparency.setMaximum(100 - originalTransparencyAsPercent); - originalFilters = fr.getFeatureFilters(); + originalFilters = new HashMap<>(fr.getFeatureFilters()); // shallow copy try { diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java index c58461e..16cb684 100644 --- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java +++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java @@ -1070,7 +1070,7 @@ public abstract class FeatureRendererModel @Override public Map getFeatureFilters() { - return new HashMap<>(featureFilters); + return featureFilters; } @Override -- 1.7.10.2