I recently replaced our custom email regex we were using in our project with org.apache.commons.validator.routines.EmailValidator, but it broke 2 of my cases in the unit tests I had written for it:
-" email@example.com" expected to be invalid
-"firstname.lastname@example.org " expected to be invalid
Are those considered valid in RFC1034/RFC1123? If not, a simple fix would be to check for leading/trailing spaces at the same location were you check that the email doesn't end with a period, at line 162 or EmailValidator.java, since it's cheap as well.