Commit 2df7460b authored by Tom Evans's avatar Tom Evans

OF-807: S2S server name format

Per PR review feedback.
parent 5e9af5f2
...@@ -54,7 +54,7 @@ public class StringUtils { ...@@ -54,7 +54,7 @@ public class StringUtils {
private static final char[] LT_ENCODE = "<".toCharArray(); private static final char[] LT_ENCODE = "<".toCharArray();
private static final char[] GT_ENCODE = ">".toCharArray(); private static final char[] GT_ENCODE = ">".toCharArray();
private static final String DOMAIN_NAME = "^(?:[A-Za-z0-9][A-Za-z0-9\\-]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$"; private static final Pattern DOMAIN_NAME = Pattern.compile("^(?:[A-Za-z0-9][A-Za-z0-9\\-]{0,61}[A-Za-z0-9]|[A-Za-z0-9])$");
private StringUtils() { private StringUtils() {
// Not instantiable. // Not instantiable.
...@@ -1131,10 +1131,9 @@ public class StringUtils { ...@@ -1131,10 +1131,9 @@ public class StringUtils {
if (domain == null) { if (domain == null) {
return false; return false;
} }
Pattern re = Pattern.compile(DOMAIN_NAME);
StringTokenizer parser = new StringTokenizer(domain, "."); StringTokenizer parser = new StringTokenizer(domain, ".");
while (parser.hasMoreTokens()) { while (parser.hasMoreTokens()) {
if (!re.matcher(parser.nextToken()).matches()) { if (!DOMAIN_NAME.matcher(parser.nextToken()).matches()) {
return false; return false;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment