Skip to content

Commit

Permalink
LPS-22277 domain name not allowed to start or end with period
Browse files Browse the repository at this point in the history
  • Loading branch information
hhuijser authored and brianchandotcom committed Oct 24, 2011
1 parent cc01a4b commit 1a6e279
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions portal-service/src/com/liferay/portal/kernel/util/Validator.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,12 @@ public static boolean isDomain(String domainName) {
return false;
}

if (domainName.startsWith(StringPool.PERIOD) ||
domainName.endsWith(StringPool.PERIOD)) {

return false;
}

if (!domainName.contains(StringPool.PERIOD) &&
!domainName.equals(_LOCALHOST)) {

Expand All @@ -390,14 +396,14 @@ public static boolean isDomain(String domainName) {
if ((i == 0) && (c == CharPool.DASH)) {
return false;
}
else if ((i == (domainNamePartCharArray.length - 1)) &&
(c == CharPool.DASH)) {

if ((i == (domainNamePartCharArray.length - 1)) &&
(c == CharPool.DASH)) {

return false;
}
else if ((!isChar(c)) && (!isDigit(c)) &&
(c != CharPool.DASH)) {

if ((!isChar(c)) && (!isDigit(c)) && (c != CharPool.DASH)) {
return false;
}
}
Expand Down

0 comments on commit 1a6e279

Please sign in to comment.