Currently, EmailValidator4J's Parsers maintain internal state related to Warnings. The Parsers are instantiated at Validator construction time and then reused.
As such, as soon as a Warning is in a Parser the EmailValidator will incorrectly give that Warning back for any subsequent address checked.
Test case:
@Test
public void validatorCanBeReused() {
EmailValidator validator = new EmailValidator();
validator.isValid("test@[127.0.0.0]");
Assert.assertFalse(validator.getWarnings().isEmpty());
validator.isValid("test@example.com");
Assert.assertFalse(validator.hasWarnings()); // Fails due to previous Warning still being present
}
Currently, EmailValidator4J's Parsers maintain internal state related to Warnings. The Parsers are instantiated at Validator construction time and then reused.
As such, as soon as a Warning is in a Parser the EmailValidator will incorrectly give that Warning back for any subsequent address checked.
Test case: