summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <david.pursehouse@sonymobile.com>2013-06-26 17:09:52 +0900
committerDavid Pursehouse <david.pursehouse@sonymobile.com>2013-06-26 17:18:32 +0900
commitdc57f029208f3938c774dbc319d64c3190a8cdb6 (patch)
tree59adf055f56b443a0d8a7977a4eac7a3321d41c8
parentabec26d1ebb47f53b3730c1ac8b7ce5c2b4d848a (diff)
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
-rw-r--r--gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java
index 83560c106e..2e14dfb40c 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ProjectConfig.java
@@ -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 {