Skip to content

WorkerFactory.newWorker() accepts blank/whitespace-only task queue names #3030

Description

@ad-kat

Bug found:

WorkerFactory.newWorker(taskQueue) validates against null and empty strings but not blank/whitespace-only strings:

Code snippet:
Preconditions.checkArgument(
!Strings.isNullOrEmpty(taskQueue), "taskQueue should not be an empty string");

This means factory.newWorker(" ") silently passes validation and creates a worker with a whitespace-only task queue name, which will fail at the server level with a cryptic error rather than a clear, early IllegalArgumentException.

Expected Behavior:
newWorker(" ") should throw IllegalArgumentException with a clear message.

Actual Behavior:
newWorker(" ") passes validation silently.

PS:
Other parts of this codebase already handle this correctly —
StartNexusOperationOptions.setId() uses trim().isEmpty() for the same reason.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions