Skip to content

Commit

Permalink
Fix for Github issue:
Browse files Browse the repository at this point in the history
  • Loading branch information
wwillard7800 committed Jan 10, 2022
1 parent db50c37 commit 09311bc
Showing 1 changed file with 23 additions and 1 deletion.
Expand Up @@ -132,14 +132,23 @@ public void set(String key, String value, ContextExpression contexts, Labels lab
changeLog));
} else {
ChangeLogParameter param = findParameter(key, changeLog);
if (param != null && ! param.isGlobal() && param.getChangeLog() == changeLog) {
if (param != null && isDuplicate(param) && ! param.isGlobal() && param.getChangeLog() == changeLog) {
changeLogParameters.remove(param);
}
//this is a non-global param, just add it
changeLogParameters.add(new ChangeLogParameter(key, value, contexts, labels, databases, globalParam, changeLog));
}
}

private boolean isDuplicate(ChangeLogParameter param) {
for (ChangeLogParameter parameter : changeLogParameters) {
if (param != parameter && param.isDuplicate(parameter)) {
return true;
}
}
return false;
}

/**
* Return the value of a parameter
*
Expand Down Expand Up @@ -343,6 +352,19 @@ public boolean isValid() {
return isValid;
}

public boolean isDuplicate(ChangeLogParameter other) {
String contextString = (this.getValidContexts() != null ? this.getValidContexts().toString() : null);
String labelsString = (this.getLabels() != null ? this.getLabels().toString() : null);
String databases = (this.getValidDatabases() != null ? StringUtil.join(this.getValidDatabases(), ",") : null);

String otherContextString = (other.getValidContexts() != null ? other.getValidContexts().toString() : null);
String otherLabelsString = (other.getLabels() != null ? other.getLabels().toString() : null);
String otherDatabases = (other.getValidDatabases() != null ? StringUtil.join(other.getValidDatabases(), ",") : null);
return StringUtil.equalsIgnoreCaseAndEmpty(contextString, otherContextString) &&
StringUtil.equalsIgnoreCaseAndEmpty(labelsString, otherLabelsString) &&
StringUtil.equalsIgnoreCaseAndEmpty(databases, otherDatabases);
}

public boolean isGlobal() {
return global;
}
Expand Down

0 comments on commit 09311bc

Please sign in to comment.