Skip to content

Commit

Permalink
Painless: ensure type "UnmodifiableMap" for params
Browse files Browse the repository at this point in the history
Signed-off-by: Rohit Ashiwal <rashiwal@amazon.com>
  • Loading branch information
r1walz committed May 29, 2024
1 parent 84ad3a7 commit 5851f44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion server/src/main/java/org/opensearch/script/Script.java
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ public Script(StreamInput in) throws IOException {
@SuppressWarnings("unchecked")
Map<String, String> options = (Map<String, String>) (Map) in.readMap();
this.options = options;
this.params = in.readMap();
this.params = Collections.unmodifiableMap(in.readMap());
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion server/src/main/java/org/opensearch/script/UpdateScript.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package org.opensearch.script;

import java.util.Collections;
import java.util.Map;

/**
Expand All @@ -53,7 +54,7 @@ public abstract class UpdateScript {
private final Map<String, Object> ctx;

public UpdateScript(Map<String, Object> params, Map<String, Object> ctx) {
this.params = params;
this.params = Collections.unmodifiableMap(params);
this.ctx = ctx;
}

Expand Down

0 comments on commit 5851f44

Please sign in to comment.