devshawn / kafka-gitops

🚀Manage Apache Kafka topics and generate ACLs through a desired state file.
https://devshawn.github.io/kafka-gitops
Apache License 2.0
321 stars 71 forks source link

Missing properties are not reported clearly #97

Open tgdavies opened 1 year ago

tgdavies commented 1 year ago

I had a reference to a property in my state.yaml:

replication: ${my_data_default_replication}

which I had failed to define in my props file.

The exception message is not very helpful.

[INFO] reading props from ../config/prod.props java.lang.NullPointerException at com.devshawn.kafka.gitops.service.ParserService.parseStateFile(ParserService.java:84) at com.devshawn.kafka.gitops.service.ParserService.parseStateFile(ParserService.java:42) at com.devshawn.kafka.gitops.StateManager.getAndValidateStateFile(StateManager.java:72) at com.devshawn.kafka.gitops.cli.ValidateCommand.call(ValidateCommand.java:26) at com.devshawn.kafka.gitops.cli.ValidateCommand.call(ValidateCommand.java:15) at picocli.CommandLine.executeUserObject(CommandLine.java:1783) at picocli.CommandLine.access$900(CommandLine.java:145) at picocli.CommandLine$RunLast.handle(CommandLine.java:2141) at picocli.CommandLine$RunLast.handle(CommandLine.java:2108) at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:1975) at picocli.CommandLine.execute(CommandLine.java:1904) at com.devshawn.kafka.gitops.MainCommand.main(MainCommand.java:69)

joschi commented 1 year ago

@tgdavies Which version of kafka-gitops are you using?

The string "reading props from" doesn't appear in its sources anywhere. 🤔

ParserService.java:84 is about extracting the exception root cause and unfortunately offers quite some opportunities to fail with a NullPointerException: https://github.com/devshawn/kafka-gitops/blob/0.2.15/src/main/java/com/devshawn/kafka/gitops/service/ParserService.java#L84

Would you be able to share your desired state file, the properties file, and the exact command you're running?