Skip to content

Commit

Permalink
fix(core): allow null domain in brand check
Browse files Browse the repository at this point in the history
* when searching for brand containing domain of passed URL we used not null-safe check
* switched the order of objects to not throw an exception if configuration of app does not exist
  • Loading branch information
Johaney-s committed Aug 17, 2022
1 parent 23a7fbe commit 226fb70
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,12 @@ public void setBrands(List<Brand> brands) {
* @return brand or null if domain is not present in the configuration
*/
public static Brand getBrandContainingDomain(String domain) {
Utils.notNull(domain, "domain");
for (Brand brand : instance.getBrands()) {
PerunAppsConfig.NewApps newApps = brand.getNewApps();
if (brand.getOldGuiDomain().equals(domain) || newApps.getAdmin().equals(domain) || newApps.getProfile().equals(domain)
|| newApps.getPublications().equals(domain) || newApps.getPwdReset().equals(domain) || newApps.getApi().equals(domain)
|| newApps.getConsolidator().equals(domain) || newApps.getLinker().equals(domain)) {
if (domain.equals(brand.getOldGuiDomain()) || domain.equals(newApps.getAdmin()) || domain.equals(newApps.getProfile())
|| domain.equals(newApps.getPublications()) || domain.equals(newApps.getPwdReset()) || domain.equals(newApps.getApi())
|| domain.equals(newApps.getConsolidator()) || domain.equals(newApps.getLinker())) {
return brand;
}
}
Expand Down

0 comments on commit 226fb70

Please sign in to comment.