Skip to content

Commit ed503b6

Browse files
committed
update validation code
Signed-off-by: Jeff Mesnil <[email protected]>
1 parent b915d7e commit ed503b6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

spec/src/main/java/io/a2a/spec/JSONRPCRequest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ public T getParams() {
7676
}
7777

7878
protected void validateAndSetJsonParameters(String jsonrpc, String method, Object id, T params, boolean paramsIsRequired) {
79-
if (jsonrpc != null && ! jsonrpc.equals(JSONRPC_VERSION)) {
79+
this.jsonrpc = Utils.defaultIfNull(jsonrpc, JSONRPC_VERSION);
80+
if (!JSONRPC_VERSION.equals(this.jsonrpc)) {
8081
throw new IllegalArgumentException("Invalid JSON-RPC protocol version");
8182
}
82-
this.jsonrpc = Utils.defaultIfNull(jsonrpc, JSONRPC_VERSION);
8383
Assert.checkNotNullParam("method", method);
8484
this.method = method;
8585
Assert.isNullOrStringOrInteger(id);

0 commit comments

Comments
 (0)