[ 
https://issues.apache.org/jira/browse/VALIDATOR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17141587#comment-17141587
 ] 

Sebb commented on VALIDATOR-463:
--------------------------------

The clearTLDOverrides method is deliberately package protected as it can result 
in thread safety issues.

For development testing purposes (only) you could create a class in the same 
package as DomainValidator which would have access to the method.

> The DomainValidator doesn't work in a hot-reloading context because of the 
> inUse flag
> -------------------------------------------------------------------------------------
>
>                 Key: VALIDATOR-463
>                 URL: https://issues.apache.org/jira/browse/VALIDATOR-463
>             Project: Commons Validator
>          Issue Type: Wish
>    Affects Versions: 1.6
>         Environment: {code:java}
>  {code}
>            Reporter: Christian Kaps
>            Priority: Major
>
> We use the DomainValidator in a Play Framework application. The issue is, 
> that it breaks the development cycle, because of the following exception:
> {code:java}
> java.lang.IllegalStateException: Can only invoke this method before calling 
> getInstance at 
> org.apache.commons.validator.routines.DomainValidator.updateTLDOverride(DomainValidator.java:1919)
> {code}
> Play uses hot-reloading, which means that the application compiles changed 
> code and reloads the Play server with the changes. So if I change some code, 
> then the error occurs because the DomainValidator stores its internal state 
> in a global variable. The code that calls `updateTLDOverride` is loaded by 
> Guice as an eager singleton. There is no other earliest entry point for the 
> application. There is a `clearTLDOverrides` method but this isn't accessible 
> from my code. If I had access to this method, then I could add a shutdown 
> hook, which could call it.
> The same issue occurs also in our integration tests.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to