Skip to content

NullPointerException when using a service that is not a Ns4Kafka instance #349

@loicgreffier

Description

@loicgreffier

In the Kafkactl config, define a service that is not Ns4Kafka:

kafkactl:
  contexts:
  ...
current-namespace: myNamespace
api: https://gitlab.com # Something invalid, but that actually exists
user-token: admin

Run kafkactl auth renew:

It triggers:

java.lang.NullPointerException
	at com.michelin.kafkactl.service.LoginService.login(LoginService.java:150)
	at com.michelin.kafkactl.service.LoginService.doAuthenticate(LoginService.java:84)
	at com.michelin.kafkactl.command.auth.AuthRenew.call(AuthRenew.java:58)
	at com.michelin.kafkactl.command.auth.AuthRenew.call(AuthRenew.java:34)
	at picocli.CommandLine.executeUserObject(CommandLine.java:2031)
	at picocli.CommandLine.access$1500(CommandLine.java:148)
	at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2469)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2461)
	at picocli.CommandLine$RunLast.handle(CommandLine.java:2423)
	at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
	at picocli.CommandLine$RunLast.execute(CommandLine.java:2425)
	at picocli.CommandLine.execute(CommandLine.java:2174)
	at io.micronaut.configuration.picocli.PicocliRunner.execute(PicocliRunner.java:226)
	at io.micronaut.configuration.picocli.PicocliRunner.execute(PicocliRunner.java:188)
	at com.michelin.kafkactl.Kafkactl.main(Kafkactl.java:99)
	at java.base@21.0.9/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

If the login response is not compliant, it should warn that the configured API is not an Ns4Kafka API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions