jsonschema2pojo icon indicating copy to clipboard operation
jsonschema2pojo copied to clipboard

Maven Plugin: inconsistent logging of ClassAlreadyExistsException

Open tonketonky opened this issue 2 years ago • 1 comments
trafficstars

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!

tonketonky avatar Aug 11 '23 13:08 tonketonky

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

joelittlejohn avatar Aug 11 '23 14:08 joelittlejohn