JAL-2843 FeatureRenderer.getFeatureFilters returns the map, not a copy
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 8 Dec 2017 15:10:59 +0000 (15:10 +0000)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Fri, 8 Dec 2017 15:10:59 +0000 (15:10 +0000)
src/jalview/api/FeatureRenderer.java
src/jalview/gui/FeatureSettings.java
src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java

index ead84fa..cf3c8da 100644 (file)
@@ -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
    */
index 4b4f363..5fc00a3 100644 (file)
@@ -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
     {
index c58461e..16cb684 100644 (file)
@@ -1070,7 +1070,7 @@ public abstract class FeatureRendererModel
   @Override
   public Map<String, FeatureMatcherSetI> getFeatureFilters()
   {
-    return new HashMap<>(featureFilters);
+    return featureFilters;
   }
 
   @Override