Skip to content

Null pointer exception on passing empty search attribute in workflow options #2276

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
lazy-ninja opened this issue Oct 17, 2024 · 2 comments · Fixed by #2277
Closed

Null pointer exception on passing empty search attribute in workflow options #2276

lazy-ninja opened this issue Oct 17, 2024 · 2 comments · Fixed by #2277

Comments

@lazy-ninja
Copy link

lazy-ninja commented Oct 17, 2024

Expected Behavior

It shouldn't throw a null pointer exception.

//return null for empty search attributes. 
SearchAttributesUtil.encodeTyped(options.getTypedSearchAttributes()); 

//on setting null search attributes in the StartWorkflowExecutionRequest, it will throw NPE
request.setSearchAttributes(startParameters.getSearchAttributes());

//StartWorkflowExecutionRequest#setSearchAttributes
if (searchAttributesBuilder_ == null) {
  if (value == null) {
    throw new NullPointerException();
  }

Actual Behavior

It throws null pointer exception

Steps to Reproduce the Problem

  1. Create workflow options as
WorkflowOptions workflowOptions = WorkflowOptions.newBuilder()
      .setTaskQueue("queue")
      .setWorkflowId("workflow-id-1")
      .setTypedSearchAttributes(SearchAttributes.EMPTY)
      .build();
  1. create workflow stub for any workflow
stub = workflowClient.newWorkflowStub(SampleWorkflow.class, workflowOptions);
  1. Submit for execution
WorkflowClient.start(stub::execute, {});

Specifications

  • Version: 1.22.3
  • Platform: MacOS
@Quinn-With-Two-Ns
Copy link
Contributor

Thanks for the bug report! will file a fix for this.

@lazy-ninja
Copy link
Author

@Quinn-With-Two-Ns thanks for fixing it. can you fix it in the 1.22.x as well?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants