Allow zero-length lists in EventLog entries.

(I'm verifying that the consumers of EventLog -- logcat, checkin -- are OK with this.)
Improve the error handling in RestoreSession.
This commit is contained in:
Dan Egnor
2009-07-29 12:57:16 -07:00
parent bb9001c69a
commit 0084da561e
2 changed files with 38 additions and 34 deletions

View File

@@ -124,10 +124,6 @@ public class EventLog {
"A List must have fewer than "
+ Byte.MAX_VALUE + " items in it.");
}
if (items.length < 1) {
throw new IllegalArgumentException(
"A List must have at least one item in it.");
}
for (int i = 0; i < items.length; i++) {
final Object item = items[i];
if (item == null) {
@@ -223,7 +219,7 @@ public class EventLog {
case LIST:
if (mBuffer.remaining() < 1) return null;
int length = mBuffer.get();
if (length <= 0) return null;
if (length < 0) return null;
Object[] array = new Object[length];
for (int i = 0; i < length; ++i) {
array[i] = decodeObject();