joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc
http://www.jsonschema2pojo.org
Apache License 2.0
6.24k stars 1.66k forks source link

Maven Plugin: inconsistent logging of ClassAlreadyExistsException #1555

Closed tonketonky closed 7 months ago

tonketonky commented 1 year ago

Hi!

within this commit logging of ClassAlreadyExistsException was added to EnumRule.java. This makes it inconsistent with other *Rule.java clasess. For instance ObjectRule.java does not do it (see here).

I am not sure if such logging of ClassAlreadyExistsException is desired but suddenly getting following errors only for enums after upgrade is quite confusing:

[INFO] --- jsonschema2pojo:1.2.1:generate (default) @ my-module ---
[ERROR] Could not create enum.
org.jsonschema2pojo.exception.ClassAlreadyExistsException: com.my.package.MyEnum
    at org.jsonschema2pojo.rules.EnumRule.createEnum (EnumRule.java:349)
    at org.jsonschema2pojo.rules.EnumRule.apply (EnumRule.java:116)
    at org.jsonschema2pojo.rules.EnumRule.apply (EnumRule.java:68)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:81)
    at org.jsonschema2pojo.rules.SchemaRule.apply (SchemaRule.java:76)
    ...

Thanks for taking a look at this!

joelittlejohn commented 1 year ago

Yes, it looks like this branch is within the normal flow of things and not an exception that should be logged.