Skip to content

Commit

Permalink
MGR-138 Applied code formaters. Corrected name.
Browse files Browse the repository at this point in the history
  • Loading branch information
dheuvels committed Jul 20, 2022
1 parent 79aad55 commit 8be1be8
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
Expand Up @@ -77,7 +77,7 @@ public void setHostAliases(String hostAliases) {
Set<String> hostnames = new HashSet<String>();
Pattern splitPattern = Pattern.compile("^[ \t]*(.+?)[ \t]*$", Pattern.MULTILINE);
Matcher splitMatcher = splitPattern.matcher(hostAliases);
while(splitMatcher.find()) {
while (splitMatcher.find()) {
hostnames.add(splitMatcher.group(1));
}
site.setHostAliases(hostnames);
Expand All @@ -86,7 +86,7 @@ public void setHostAliases(String hostAliases) {
public void validate(Site site, Application application, Environment environment, Options options, Request request,
FieldProcessor fp) {
for (String name : this.site.getHostAliases()) {
if (! Pattern.matches(ValidationPatterns.HOST_PATTERN, name))
if (!Pattern.matches(ValidationPatterns.HOST_PATTERN, name))
fp.addErrorMessage(fp.getField("hostAliases"),
request.getMessage(MessageConstants.SITE_HOSTALIAS_INVALID, name));
}
Expand Down
Expand Up @@ -1086,15 +1086,16 @@ private void checkSite(Request request, Site site, FieldProcessor fp, Site curre
if (fp.hasField("site.name") && !siteRepository.isUnique(site.getId(), "name", site.getName())) {
fp.addErrorMessage(fp.getField("site.name"), request.getMessage(MessageConstants.SITE_NAME_EXISTS));
}
Set<String>hostnames = new HashSet<String>(site.getHostAliases());
Set<String> hostnames = new HashSet<String>(site.getHostAliases());
hostnames.add(site.getHost());
List<SiteImpl> hostOverlapSites = siteRepository.findSitesForHostNames(hostnames);
for (SiteImpl ovlpSite : hostOverlapSites) {
if (site.getId() == ovlpSite.getId()) continue;
if (site.getId() == ovlpSite.getId())
continue;
else {
if (ovlpSite.getHost().equals(site.getHost()) || ovlpSite.getHostAliases().contains(site.getHost()))
fp.addErrorMessage(fp.getField("site.host"), request.getMessage(MessageConstants.SITE_HOST_EXISTS,
ovlpSite.getName()));
fp.addErrorMessage(fp.getField("site.host"),
request.getMessage(MessageConstants.SITE_HOST_EXISTS, ovlpSite.getName()));
else
fp.addErrorMessage(fp.getField("hostAliases"),
request.getMessage(MessageConstants.SITE_HOSTALIAS_EXISTS, ovlpSite.getName()));
Expand Down
2 changes: 1 addition & 1 deletion src/test/resources/xml/SitesTest-testShowSites.xml
Expand Up @@ -17,7 +17,7 @@
</field>
<field name="host" type="text" binding="host">
<sort />
<label id="host">Host</label>
<label id="host">Hostname</label>
</field>
<field name="domain" type="text" binding="domain">
<sort />
Expand Down

0 comments on commit 8be1be8

Please sign in to comment.