Allow illegal label names from default search predicate

Ancient user watch filters may be configured with strings that
are not valid label names, e.g. "plugins/defaultuser". At the time
these were created the user was expecting to match a project. Now
they blow up the strict checking in LabelType trying to setup an
object for EqualsLabelPredicate to fail to match.

Be more lenient here to allow the label to fail to match.

Change-Id: I52d45456c67924e1981fbbe52a62adfceeebe869
This commit is contained in:
Shawn Pearce
2014-04-24 14:22:34 -07:00
parent a5d3392a6d
commit 8d516ca9dd
2 changed files with 5 additions and 1 deletions

View File

@@ -27,6 +27,10 @@ import java.util.Map;
public class LabelType {
public static LabelType withDefaultValues(String name) {
checkName(name);
return withDefaultValuesDoNotCheckName(name);
}
public static LabelType withDefaultValuesDoNotCheckName(String name) {
List<LabelValue> values = new ArrayList<>(2);
values.add(new LabelValue((short) 0, "Rejected"));
values.add(new LabelValue((short) 1, "Approved"));

View File

@@ -104,7 +104,7 @@ class EqualsLabelPredicate extends IndexPredicate<ChangeData> {
}
}
return LabelType.withDefaultValues(toFind);
return LabelType.withDefaultValuesDoNotCheckName(toFind);
}
private boolean match(Change change, int value, Account.Id approver,