-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
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
[BUG][JAVA] Static Initializer Block missing in JSON support class #16860
Comments
…ools#16860 Make initializer block for GSON builder static, see OpenAPITools#16860
Hey, thanks for providing a fix for that issue. Can we estimate when this fix will be merged ? |
@JanUlrichR have you tested it locally to confirm the fix? |
I've filed #16984 to add a test but it doesn't throw any exception. How can I properly repeat the issue? |
Hey @wing328 , |
Are you using I forgot to mention my tests passed locally (and in the CI) when ran with |
For me sbt does not work. But the errors I receive seem to be some misconfiguration on my end. (Haven't worked with sbt before) I checked with maven. |
Which version of JDK are you using? I'm using OpenJDK 11 on Mac |
…16892) * [okhttp-gson] Make initializer block for GSON builder static #16860 Make initializer block for GSON builder static, see #16860 * update sapmles --------- Co-authored-by: Andre Wachsmuth <[email protected]>
Description
To reproduce the error I just used the Swagger Petstore example. I generated java code with openapi-generator version 7.0.1 and tried to create a model an use toJson() to get the Json-String from the model.
The result is an NullPointerException: Cannot invoke "com.google.gson.Gson.toJson(Object)" because the return value of "com.domain.test.JSON.getGson()" is null
I think the problem might be, that no static initializer block is used in the JSON support class. There is only an instance initializer block like this
When i add "static" to make it a static initializer block everything works as expected.
The text was updated successfully, but these errors were encountered: