Allow label values to be configured with no text
Internal Server Error is raised during Gerrit startup if a project is configured with a label that has a value with no text: [label My-Label] value = -1 Failed value = 0 value = +1 Passed (Note that there is no text after "value = 0".) Internal Server Error is raised due to IndexOutOfBoundsException while constructing a LabelValue and assuming that the label has both a numeric value and a text value. Fix this by checking if there is a text value, and if there is no text value, defaulting to an empty string. Change-Id: Ib2f0532e64be745ba1ed83c372e804743a5afa7e
This commit is contained in:
@@ -528,9 +528,10 @@ public class ProjectConfig extends VersionedMetaData {
|
||||
if (parts.isEmpty()) {
|
||||
throw new IllegalArgumentException("empty value");
|
||||
}
|
||||
String valueText = parts.size() > 1 ? parts.get(1) : "";
|
||||
return new LabelValue(
|
||||
Shorts.checkedCast(PermissionRule.parseInt(parts.get(0))),
|
||||
parts.get(1));
|
||||
valueText);
|
||||
}
|
||||
|
||||
private void loadLabelSections(Config rc) throws IOException {
|
||||
|
||||
Reference in New Issue
Block a user