@@ -399,8 +399,10 @@ else if (userId == null) {
399
399
logger .info ("No feature flag was found for key \" {}\" ." , featureKey );
400
400
return false ;
401
401
}
402
+
402
403
Map <String , ?> copiedAttributes = copyAttributes (attributes );
403
404
FeatureDecision featureDecision = decisionService .getVariationForFeature (featureFlag , userId , copiedAttributes );
405
+
404
406
if (featureDecision .variation != null ) {
405
407
if (featureDecision .decisionSource .equals (FeatureDecision .DecisionSource .EXPERIMENT )) {
406
408
sendImpression (
@@ -647,7 +649,6 @@ else if (userId == null) {
647
649
648
650
String variableValue = variable .getDefaultValue ();
649
651
Map <String , ?> copiedAttributes = copyAttributes (attributes );
650
-
651
652
FeatureDecision featureDecision = decisionService .getVariationForFeature (featureFlag , userId , copiedAttributes );
652
653
if (featureDecision .variation != null ) {
653
654
LiveVariableUsageInstance liveVariableUsageInstance =
@@ -686,9 +687,10 @@ public List<String> getEnabledFeatures(@Nonnull String userId, @Nonnull Map<Stri
686
687
return enabledFeaturesList ;
687
688
}
688
689
690
+ Map <String , ?> copiedAttributes = copyAttributes (attributes );
689
691
for (FeatureFlag featureFlag : projectConfig .getFeatureFlags ()){
690
692
String featureKey = featureFlag .getKey ();
691
- if (isFeatureEnabled (featureKey , userId , attributes ))
693
+ if (isFeatureEnabled (featureKey , userId , copiedAttributes ))
692
694
enabledFeaturesList .add (featureKey );
693
695
}
694
696
@@ -826,9 +828,9 @@ private boolean validateUserId(String userId) {
826
828
}
827
829
828
830
/**
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
830
832
*
831
- * @param attributes the attributes map being validated
833
+ * @param attributes map to copy
832
834
* @return copy of attributes
833
835
*/
834
836
private Map <String , ?> copyAttributes (Map <String , ?> attributes ) {
0 commit comments