| Conditions | 4 |
| Total Lines | 10 |
| Code Lines | 9 |
| Lines | 7 |
| Ratio | 70 % |
| Changes | 0 | ||
| 1 | package com.osomapps.pt.tokenemail; |
||
| 21 | @Override |
||
| 22 | public void validate(final Object obj, final Errors errors) { |
||
| 23 | final String email = (String) obj; |
||
| 24 | if (email == null || email.trim().isEmpty()) { |
||
| 25 | errors.reject("email", "Invalid empty email address"); |
||
| 26 | return; |
||
| 27 | } |
||
| 28 | final Matcher matcher = EMAIL_PATTERN.matcher(email); |
||
| 29 | if (!matcher.matches()) { |
||
| 30 | errors.reject("email", "Invalid email address (" + email + ")"); |
||
| 31 | } |
||
| 34 |