Make Copy of collate parameter map
Test failures showed problems with passing down the same collate parameter map reference from the phrase suggestion builder to the context where. This changes the collate parameter setters to make a shallow copy of the map passed in.
This commit is contained in:
parent
daeffb149c
commit
7aa29e3f7c
|
@ -346,10 +346,12 @@ public class PhraseSuggestionBuilder extends SuggestionBuilder<PhraseSuggestionB
|
|||
}
|
||||
|
||||
/**
|
||||
* Sets additional params for collate script
|
||||
* Adds additional parameters for collate scripts. Previously added parameters on the
|
||||
* same builder will be overwritten.
|
||||
*/
|
||||
public PhraseSuggestionBuilder collateParams(Map<String, Object> collateParams) {
|
||||
this.collateParams = collateParams;
|
||||
Objects.requireNonNull(collateParams, "collate parameters cannot be null.");
|
||||
this.collateParams = new HashMap<>(collateParams);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ class PhraseSuggestionContext extends SuggestionContext {
|
|||
}
|
||||
|
||||
void setCollateScriptParams(Map<String, Object> collateScriptParams) {
|
||||
this.collateScriptParams = collateScriptParams;
|
||||
this.collateScriptParams = new HashMap<>(collateScriptParams);
|
||||
}
|
||||
|
||||
void setCollatePrune(boolean prune) {
|
||||
|
|
Loading…
Reference in New Issue