Merge "Fixed AutofillServiceHelper.assertValid() so it throws the right exception." into pi-dev

am: 0049ec1410

Change-Id: I815bf3aa060005b8c3f0512e38042ae377c8e236
This commit is contained in:
Felipe Leme
2018-03-24 00:53:12 +00:00
committed by android-build-merger

View File

@@ -26,7 +26,13 @@ final class AutofillServiceHelper {
static AutofillId[] assertValid(@Nullable AutofillId[] ids) {
Preconditions.checkArgument(ids != null && ids.length > 0, "must have at least one id");
return Preconditions.checkArrayElementsNotNull(ids, "ids");
// Can't use Preconditions.checkArrayElementsNotNull() because it throws NPE instead of IAE
for (int i = 0; i < ids.length; ++i) {
if (ids[i] == null) {
throw new IllegalArgumentException("ids[" + i + "] must not be null");
}
}
return ids;
}
private AutofillServiceHelper() {