Skip to content

NullPointerException when invoking kcctl patch offsets without payload #422

Description

@gunnarmorling

This situation should be handled more gracefully, i.e. by displaying an error message to the user rather than stacktrace:

kcctl patch offsets inventory-connector
java.lang.NullPointerException
	at org.kcctl.command.PatchOffsetsCommand.call(PatchOffsetsCommand.java:162)
	at org.kcctl.command.PatchOffsetsCommand.call(PatchOffsetsCommand.java:44)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at io.quarkus.picocli.runtime.PicocliRunner$EventExecutionStrategy.execute(PicocliRunner.java:26)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at io.quarkus.picocli.runtime.PicocliRunner.run(PicocliRunner.java:40)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

Also let's suppress the stacktrace when trying to patch the offsets of a running connector and just display an error message (in kcctl terms, not KC REST API terms):

org.kcctl.service.KafkaConnectException: Connectors must be in the STOPPED state before their offsets can be modified. This can be done for the specified connector by issuing a 'PUT' request to the '/connectors/inventory-connector/stop' endpoint
	at org.kcctl.service.KafkaConnectResponseExceptionMapper.toThrowable(KafkaConnectResponseExceptionMapper.java:26)
	at org.kcctl.service.KafkaConnectResponseExceptionMapper.toThrowable(KafkaConnectResponseExceptionMapper.java:22)
	at org.jboss.resteasy.microprofile.client.ExceptionMapping$HandlerException.mapException(ExceptionMapping.java:60)
	at io.quarkus.restclient.runtime.QuarkusInvocationContextImpl.interceptorChainCompleted(QuarkusInvocationContextImpl.java:84)
	at io.quarkus.restclient.runtime.QuarkusInvocationContextImpl.proceed(QuarkusInvocationContextImpl.java:106)
	at io.smallrye.faulttolerance.FaultToleranceInterceptor.lambda$syncFlow$3(FaultToleranceInterceptor.java:253)
	at io.smallrye.faulttolerance.core.InvocationContext.call(InvocationContext.java:20)
	at io.smallrye.faulttolerance.core.Invocation.apply(Invocation.java:29)
	at io.smallrye.faulttolerance.core.retry.Retry.doApply(Retry.java:88)
	at io.smallrye.faulttolerance.core.retry.Retry.apply(Retry.java:42)
	at io.smallrye.faulttolerance.FaultToleranceInterceptor.syncFlow(FaultToleranceInterceptor.java:255)
	at io.smallrye.faulttolerance.FaultToleranceInterceptor.intercept(FaultToleranceInterceptor.java:182)
	at io.smallrye.faulttolerance.FaultToleranceInterceptor_Bean.intercept(Unknown Source)
	at io.quarkus.restclient.runtime.QuarkusInvocationContextImpl$InterceptorInvocation.invoke(QuarkusInvocationContextImpl.java:195)
	at io.quarkus.restclient.runtime.QuarkusInvocationContextImpl.invokeNext(QuarkusInvocationContextImpl.java:68)
	at io.quarkus.restclient.runtime.QuarkusInvocationContextImpl.proceed(QuarkusInvocationContextImpl.java:104)
	at io.quarkus.restclient.runtime.QuarkusProxyInvocationHandler.invoke(QuarkusProxyInvocationHandler.java:162)
	at jdk.proxy4/jdk.proxy4.$Proxy48.patchConnectorOffsets(Unknown Source)
	at org.kcctl.command.PatchOffsetsCommand.call(PatchOffsetsCommand.java:163)
	at org.kcctl.command.PatchOffsetsCommand.call(PatchOffsetsCommand.java:44)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2041)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2453)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2415)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2273)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2417)
	at io.quarkus.picocli.runtime.PicocliRunner$EventExecutionStrategy.execute(PicocliRunner.java:26)
	at picocli.CommandLine.execute(CommandLine.java:2170)
	at io.quarkus.picocli.runtime.PicocliRunner.run(PicocliRunner.java:40)
	at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:132)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
	at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
	at io.quarkus.runner.GeneratedMain.main(Unknown Source)
	at [email protected]/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions