fix(grpc): avoid NPE when listTasks is called without a tenant by Emryswu · Pull Request #1240 · a2aproject/a2a-java · GitHub
Skip to content

fix(grpc): avoid NPE when listTasks is called without a tenant - #1240

Open
Emryswu wants to merge 1 commit into
a2aproject:mainfrom
Emryswu:fix/list-tasks-null-tenant
Open

Emryswu wants to merge 1 commit into
a2aproject:mainfrom
Emryswu:fix/list-tasks-null-tenant

Conversation

@Emryswu

@Emryswu Emryswu commented Oct 21, 2026

Copy link
Copy Markdown

Calling JSON-RPC listTasks without a tenant throws an NPE before the request is sent: the MapStruct-generated ListTasksParamsMapperImpl.toProto calls setTenant(null) on the protobuf builder. This happens with both ListTasksParams.builder().build() and new ListTasksParams().

The fix adds the same conditionExpression null check already used for the other nullable fields in ListTasksParamsMapper, and for tenant in the neighboring request mappers (TaskQueryParamsMapper, TaskIdParamsMapper, etc.). Non-null tenants are still mapped as before.

REST and gRPC are not affected: both build ListTasksRequest manually and already guard the tenant.

Tests cover the default builder, the no-arg constructor and a non-null tenant, both at the mapper level and through JSONRPCTransport (checking the actual wire request). All 585 tests in the affected modules pass. The changed files pass strict Checkstyle; the 478 pre-existing violations on main are unchanged.

Related to #1207

@Emryswu
Emryswu force-pushed the fix/list-tasks-null-tenant branch from aa163a9 to c899da6 Compare October 21, 2026 12:40

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant