@@ -399,8 +399,10 @@ else if (userId == null) {
399399 logger .info ("No feature flag was found for key \" {}\" ." , featureKey );
400400 return false ;
401401 }
402+
402403 Map <String , ?> copiedAttributes = copyAttributes (attributes );
403404 FeatureDecision featureDecision = decisionService .getVariationForFeature (featureFlag , userId , copiedAttributes );
405+
404406 if (featureDecision .variation != null ) {
405407 if (featureDecision .decisionSource .equals (FeatureDecision .DecisionSource .EXPERIMENT )) {
406408 sendImpression (
@@ -647,7 +649,6 @@ else if (userId == null) {
647649
648650 String variableValue = variable .getDefaultValue ();
649651 Map <String , ?> copiedAttributes = copyAttributes (attributes );
650-
651652 FeatureDecision featureDecision = decisionService .getVariationForFeature (featureFlag , userId , copiedAttributes );
652653 if (featureDecision .variation != null ) {
653654 LiveVariableUsageInstance liveVariableUsageInstance =
@@ -686,9 +687,10 @@ public List<String> getEnabledFeatures(@Nonnull String userId, @Nonnull Map<Stri
686687 return enabledFeaturesList ;
687688 }
688689
690+ Map <String , ?> copiedAttributes = copyAttributes (attributes );
689691 for (FeatureFlag featureFlag : projectConfig .getFeatureFlags ()){
690692 String featureKey = featureFlag .getKey ();
691- if (isFeatureEnabled (featureKey , userId , attributes ))
693+ if (isFeatureEnabled (featureKey , userId , copiedAttributes ))
692694 enabledFeaturesList .add (featureKey );
693695 }
694696
@@ -826,9 +828,9 @@ private boolean validateUserId(String userId) {
826828 }
827829
828830 /**
829- * Helper function to check that the provided attributes are null if not than it returns a copy
831+ * Helper method which makes separate copy of attributesMap variable and returns it
830832 *
831- * @param attributes the attributes map being validated
833+ * @param attributes map to copy
832834 * @return copy of attributes
833835 */
834836 private Map <String , ?> copyAttributes (Map <String , ?> attributes ) {
0 commit comments