Christian Kaps created VALIDATOR-463:
----------------------------------------
Summary: 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: Bug
Affects Versions: 1.6
Environment: {code:java}
{code}
Reporter: Christian Kaps
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.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)