[hibernate-issues] [Hibernate-JIRA] Issue Comment Edited: (BVAL-285) ValidatorFactory#close should clearly state post condidtions

Gunnar Morling (JIRA) noreply at atlassian.com
Wed Apr 4 16:29:48 EDT 2012


    [ https://hibernate.onjira.com/browse/BVAL-285?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=46184#comment-46184 ] 

Gunnar Morling edited comment on BVAL-285 at 4/4/12 3:28 PM:
-------------------------------------------------------------

Personally I'm still a bit uncertain about the {{ValidatorFactory#close()}} contract in general. Doesn't that basically mean, that one always has to check whether the factory is already closed when using a validator? If that's the case, how would one implement such a check (I think this question was already raised before, I just don't rembember what the answer was)?

I think it just feels akwards from an API perspective, that a validator spawned by a factory is invalidated when that factory is closed. Intuitively I'd expect that the validator is "detached" from the factory, that is the factory can't be used anymore after it's closed, but previously created validators should still be usable.

      was (Author: gunnar.morling):
    Personally I'm still a bit uncertain about the {{ValidatorFactory#close()}} contract in general. Doesn't that basically mean, that one always has to check whether the factory is already closed when using a validator? If that's the case, how would one implement such a check (I think this question was already raised before, I just don't rembember what the answer was)?

I think it just feels akwards from an API perspective, that a validator spawned by a factory is invalidated when that factory is closed. Intuitively I'd expect that the validator is "detached" from the factory, that is the factory can't be used anymore after it's closed, but validators created before should still be usable.
  
> ValidatorFactory#close should clearly state post condidtions 
> -------------------------------------------------------------
>
>                 Key: BVAL-285
>                 URL: https://hibernate.onjira.com/browse/BVAL-285
>             Project: Bean Validation
>          Issue Type: Improvement
>          Components: spec-general
>    Affects Versions: 1.1.next
>            Reporter: Hardy Ferentschik
>
> The Javadocs for ValidatorFactory#close says:
> {quote}
> After the _ValidatorFactory_ instance is closed, it is not allowed to call:
> * methods of this _ValidatorFactory_ instance
> * methods of _Validator_ instances created by this _ValidatorFactory_
> {quote}
> It does, however, not specified what happens if such a method is called. I think with this wording a post conditions needs to be specified, eg a _ValidationException_ will be thrown. Otherwise the docs should say that the behavior is unspecified if any of the mentioned methods is called after calling _close()_

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list