Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

NPE on JSON EmptySchema #45

Open
shoffmeister opened this issue Aug 28, 2024 · 0 comments
Open

NPE on JSON EmptySchema #45

shoffmeister opened this issue Aug 28, 2024 · 0 comments

Comments

@shoffmeister
Copy link

Whenever the built-in JSON schema parser returns EmptySchema, kwack will throw

❯ java -jar ./target/kwack-0.11.0-jar-with-dependencies.jar --bootstrap-server=localhost:9192 --topic xxx --value-serde=xxx=json:@./EmptySchema.json
SLF4J(I): Connected with provider of type [org.slf4j.reload4j.Reload4jServiceProvider]
log4j:WARN No appenders could be found for logger (io.kcache.kwack.KwackConfig).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
java.lang.NullPointerException: Cannot invoke "io.kcache.kwack.schema.ColumnDef.getColumnType()" because "valueColDef" is null
        at io.kcache.kwack.KwackEngine.initTable(KwackEngine.java:602)
        at io.kcache.kwack.KwackEngine.initTables(KwackEngine.java:585)
        at io.kcache.kwack.KwackEngine.init(KwackEngine.java:208)
        at io.kcache.kwack.KwackMain.call(KwackMain.java:156)
        at io.kcache.kwack.KwackMain.call(KwackMain.java:34)
        at picocli.CommandLine.executeUserObject(CommandLine.java:2045)
        at picocli.CommandLine.access$1500(CommandLine.java:148)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2465)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2457)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2419)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2277)
        at picocli.CommandLine$RunLast.execute(CommandLine.java:2421)
        at picocli.CommandLine.execute(CommandLine.java:2174)
        at io.kcache.kwack.KwackMain.main(KwackMain.java:297)

where EmptySchema.json this case quite literally is

{
}

I ran into this situation while I was transforming a complex OpenAPI YAML into OpenAPI JSON into JSON Schema.

I am not sure what the best way is to handle this (interactive / evolving) scenario; the (more general) root cause is that JsonTransformer.schemaToColumnDef returns null for schemas it does not handle itself. Perhaps throw an application internal exception, instead of letting pass this through to a NPE?

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

No branches or pull requests

1 participant