79612687

Date: 2025-05-08 15:15:33
Score: 0.5
Natty:
Report link

Finally, I found where the problem is. There is a sendBackgroundApiCommand() implementation in public abstract class AbstractEslClientHandler extends SimpleChannelInboundHandler<EslMessage>. The NPE happens when thenComposeAsync() is being called and the reason for that is callbackExecutor. not initialized.

public CompletableFuture<EslEvent> sendBackgroundApiCommand(Channel channel, final String command) {
    return sendApiSingleLineCommand(channel, command)
          .thenComposeAsync(result -> {
                // some code here
             }
          }, callbackExecutor);
}

I added intialization to a child class like below and the problem gone.

class InboundClientHandler extends AbstractEslClientHandler {
    // ...
    public InboundClientHandler(String password, IEslProtocolListener listener) {
       this.password = password;
       this.listener = listener;
       this.callbackExecutor = Executors.newSingleThreadExecutor();
    }
    // ...
}
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Ubuntu Learner