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 KaaAdminStyle kaaAdminStyle = resources.kaaAdminStyle();
public static final AvroUiStyle avroUiStyle = avroUiResources.avroUiStyle(); public static final AvroUiStyle avroUiStyle = avroUiResources.avroUiStyle();
private static final int MAX_ERROR_LINE_LENGTH = 200; 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"); private static final DateTimeFormat simpleDateFormat = getFormat("MM/dd/yyyy");


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


Expand Down

0 comments on commit ef0df4a

Please sign in to comment.