javahibernatesetterthrows

Setter only does assignment, yet declares that it throws a ParseException; in Hibernate


Discovered a Date setter that only does the typical assignment, yet has a throws ParseException for what seems like no good reason. No Date construction is happening in the body of the setter. Just assignment.

This is on a Hibernate entity. The setters field is annotated with @Column as nullable, insertable, and updateable. Not sure if that matters.

Is this obviously wrong and should be fixed by removing the throws or is there more research to do before deciding to remove this?


Solution

  • From your description it sounds perfectly safe to remove the throws declaration. A guess would be that the setter originally took a String and parsed it. If you have source control, a check in the history might confirm this.