joelittlejohn / jsonschema2pojo

Generate Java types from JSON or JSON Schema and annotate those types for data-binding with Jackson, Gson, etc

Home Page:http://www.jsonschema2pojo.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maven Plugin: inconsistent logging of ClassAlreadyExistsException

tonketonky opened this issue · comments

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!

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