CommitValidators: Avoid IOBE when no Change-Id footer is present

Change-Id: Id766ddb3fe87a3a828a4a9d92ae1ebc26323cf51
This commit is contained in:
Dave Borowitz
2016-05-30 09:32:17 -04:00
parent 8458cc2f4e
commit 750a6c1e49

View File

@@ -245,13 +245,14 @@ public class CommitValidators {
String errMsg = String.format(
MULTIPLE_CHANGE_ID_MSG, sha1);
throw new CommitValidationException(errMsg, messages);
}
String v = idList.get(idList.size() - 1).trim();
if (!CHANGE_ID.matcher(v).matches()) {
String errMsg = String.format(INVALID_CHANGE_ID_MSG, sha1);
messages.add(
getMissingChangeIdErrorMsg(errMsg, receiveEvent.commit));
throw new CommitValidationException(errMsg, messages);
} else {
String v = idList.get(idList.size() - 1).trim();
if (!CHANGE_ID.matcher(v).matches()) {
String errMsg = String.format(INVALID_CHANGE_ID_MSG, sha1);
messages.add(
getMissingChangeIdErrorMsg(errMsg, receiveEvent.commit));
throw new CommitValidationException(errMsg, messages);
}
}
return Collections.emptyList();
}