Skip to content

Commit

Permalink
KAA-1585: make 'emailpattern' static field
Browse files Browse the repository at this point in the history
  • Loading branch information
Serega290696 authored and Acarus committed Nov 24, 2016
1 parent 2258ba8 commit ef0df4a
Showing 1 changed file with 7 additions and 8 deletions.
Expand Up @@ -56,6 +56,9 @@ public class Utils {
public static final KaaAdminStyle kaaAdminStyle = resources.kaaAdminStyle();
public static final AvroUiStyle avroUiStyle = avroUiResources.avroUiStyle();
private static final int MAX_ERROR_LINE_LENGTH = 200;
private static Pattern emailPattern = Pattern.compile(
"^.+@.+$", Pattern.CASE_INSENSITIVE
);

private static final DateTimeFormat simpleDateFormat = getFormat("MM/dd/yyyy");

Expand All @@ -82,9 +85,9 @@ public static void handleException(Throwable caught,
/**
* Exception handler.
*
* @param caught the Throwable
* @param hasErrorMessage the has error message
* @param errorMessageCustomizer the error message customizer
* @param caught the Throwable
* @param hasErrorMessage the has error message
* @param errorMessageCustomizer the error message customizer
*/
public static void handleException(Throwable caught,
HasErrorMessage hasErrorMessage,
Expand Down Expand Up @@ -179,11 +182,7 @@ public static boolean validateEmail(String mail) {
if (mail == null || mail.length() == 0) {
return false;
}
Pattern pattern = Pattern
.compile(
"^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,6}$", Pattern.CASE_INSENSITIVE
);
Matcher matcher = pattern.matcher(mail);
Matcher matcher = emailPattern.matcher(mail);
return matcher.find();
}

Expand Down

0 comments on commit ef0df4a

Please sign in to comment.