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

NullPointerException in Jackson2Parser #1062

Open
Eliak opened this issue May 3, 2024 · 0 comments
Open

NullPointerException in Jackson2Parser #1062

Eliak opened this issue May 3, 2024 · 0 comments

Comments

@Eliak
Copy link

Eliak commented May 3, 2024

NullPointerException throws when class using com.fasterxml.jackson.annotation.JsonIdentityInfo annotation to avoid circular references.
JsonIdentityInfo annotation generates property of type: com.fasterxml.jackson.databind.deser.impl.ObjectIdValueProperty.
And result of method ObjectIdValueProperty#getMember always is null.

This is an example of a class that causes an error:

@JsonIdentityInfo(generator = com.fasterxml.jackson.annotation.ObjectIdGenerators.IntSequenceGenerator.class)
class TestObject {
   public String foo;
   public String bar;
}

This is an exception with stack trace:

java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.introspect.AnnotatedMember.getMember()" because the return value of "com.fasterxml.jackson.databind.BeanProperty.getMember()" is null
	at cz.habarta.typescript.generator.parser.Jackson2Parser$BeanHelpers.getFieldIndex(Jackson2Parser.java:688)
	at cz.habarta.typescript.generator.parser.Jackson2Parser$BeanHelpers.getFieldIndex(Jackson2Parser.java:681)
	at cz.habarta.typescript.generator.parser.Jackson2Parser$BeanHelpers.lambda$getPropertiesPairs$6(Jackson2Parser.java:640)
	at cz.habarta.typescript.generator.parser.Jackson2Parser$BeanHelpers.getPropertiesPairs(Jackson2Parser.java:642)
	at cz.habarta.typescript.generator.parser.Jackson2Parser$BeanHelpers.getPropertiesAndAccess(Jackson2Parser.java:605)
	at cz.habarta.typescript.generator.parser.Jackson2Parser.parseBean(Jackson2Parser.java:264)
	at cz.habarta.typescript.generator.parser.Jackson2Parser.parseClass(Jackson2Parser.java:254)
	at cz.habarta.typescript.generator.parser.ModelParser.parseQueue(ModelParser.java:108)
	at cz.habarta.typescript.generator.parser.ModelParser.parseModel(ModelParser.java:67)
	at cz.habarta.typescript.generator.TypeScriptGenerator.generateTypeScript(TypeScriptGenerator.java:73)
	at cz.habarta.typescript.generator.gradle.GenerateTask.generate(GenerateTask.java:263)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
	at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:125)
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