fix: Update setStringValue method to handle null values by removing the key from context
This commit is contained in:
@@ -89,8 +89,12 @@ public final class AgentContext {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void setStringValue(final String key, final String value) {
|
public void setStringValue(final String key, final String value) {
|
||||||
|
if (value == null) {
|
||||||
|
this.context.remove(key);
|
||||||
|
} else {
|
||||||
this.context.put(key, List.of(value));
|
this.context.put(key, List.of(value));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<String> getStringValues(final String key) {
|
public List<String> getStringValues(final String key) {
|
||||||
final var values = this.context.get(key);
|
final var values = this.context.get(key);
|
||||||
|
|||||||
Reference in New Issue
Block a user