Rename ProtoInputStream.isNextField to nextField.
ProtoInputStream.isNextField() skips over the current field to read the
next tag. This side effect means that calling isNextField prevents the
caller from reading the field it was just on. The "is" prefix makes it
easy to assume that the method has no side effects. Renaming to
nextField(long) with a parameter should help make it clear that the call
is as dangerous as calling nextField().
Fixes: 137294060
Test: atest android.app.usage.UsageStatsTest
Test: atest android.app.usage.cts.UsageStatsTest
Test: atest com.android.server.usage.UsageStatsDatabaseTest
Test: atest ProtoInputStreamTests
Change-Id: Ibfb8ef741f27a211f076dc0b715b64acbfc0696a
diff --git a/core/java/android/util/proto/ProtoInputStream.java b/core/java/android/util/proto/ProtoInputStream.java
index c290dff..24e7d2b 100644
--- a/core/java/android/util/proto/ProtoInputStream.java
+++ b/core/java/android/util/proto/ProtoInputStream.java
@@ -253,12 +253,14 @@
}
/**
- * Attempt to guess the next field. If there is a match, the field data will be ready to read.
- * If there is no match, nextField will need to be called to get the field number
+ * Reads the tag of the next field from the stream. If previous field value was not read, its
+ * data will be skipped over. If {@code fieldId} matches the next field ID, the field data will
+ * be ready to read. If it does not match, {@link #nextField()} or {@link #nextField(long)} will
+ * need to be called again before the field data can be read.
*
* @return true if fieldId matches the next field, false if not
*/
- public boolean isNextField(long fieldId) throws IOException {
+ public boolean nextField(long fieldId) throws IOException {
if (nextField() == (int) fieldId) {
return true;
}
diff --git a/services/usage/java/com/android/server/usage/UsageStatsProto.java b/services/usage/java/com/android/server/usage/UsageStatsProto.java
index 63bf7e7..3e88d93 100644
--- a/services/usage/java/com/android/server/usage/UsageStatsProto.java
+++ b/services/usage/java/com/android/server/usage/UsageStatsProto.java
@@ -44,7 +44,7 @@
final long token = proto.start(IntervalStatsProto.STRINGPOOL);
List<String> stringPool;
- if (proto.isNextField(IntervalStatsProto.StringPool.SIZE)) {
+ if (proto.nextField(IntervalStatsProto.StringPool.SIZE)) {
stringPool = new ArrayList(proto.readInt(IntervalStatsProto.StringPool.SIZE));
} else {
stringPool = new ArrayList();
@@ -66,12 +66,12 @@
final long token = proto.start(fieldId);
UsageStats stats;
- if (proto.isNextField(IntervalStatsProto.UsageStats.PACKAGE_INDEX)) {
+ if (proto.nextField(IntervalStatsProto.UsageStats.PACKAGE_INDEX)) {
// Fast path reading the package name index. Most cases this should work since it is
// written first
stats = statsOut.getOrCreateUsageStats(
stringPool.get(proto.readInt(IntervalStatsProto.UsageStats.PACKAGE_INDEX) - 1));
- } else if (proto.isNextField(IntervalStatsProto.UsageStats.PACKAGE)) {
+ } else if (proto.nextField(IntervalStatsProto.UsageStats.PACKAGE)) {
// No package index, try package name instead
stats = statsOut.getOrCreateUsageStats(
proto.readString(IntervalStatsProto.UsageStats.PACKAGE));
@@ -177,7 +177,7 @@
}
String action = null;
ArrayMap<String, Integer> counts;
- if (proto.isNextField(IntervalStatsProto.UsageStats.ChooserAction.NAME)) {
+ if (proto.nextField(IntervalStatsProto.UsageStats.ChooserAction.NAME)) {
// Fast path reading the action name. Most cases this should work since it is written
// first
action = proto.readString(IntervalStatsProto.UsageStats.ChooserAction.NAME);
@@ -244,7 +244,7 @@
boolean configActive = false;
final Configuration config = new Configuration();
ConfigurationStats configStats;
- if (proto.isNextField(IntervalStatsProto.Configuration.CONFIG)) {
+ if (proto.nextField(IntervalStatsProto.Configuration.CONFIG)) {
// Fast path reading the configuration. Most cases this should work since it is
// written first
config.readFromProto(proto, IntervalStatsProto.Configuration.CONFIG);
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java
index c21c403..3415d2e 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBoolTest.java
@@ -384,55 +384,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java
index 09fe40e..8796807 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamBytesTest.java
@@ -306,55 +306,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java
index 118fe34..2b54e96 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamDoubleTest.java
@@ -611,55 +611,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java
index f55d951..19bad70 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamEnumTest.java
@@ -454,55 +454,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java
index df68476..2bc61a0 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed32Test.java
@@ -431,55 +431,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java
index af4130b..a54ecf9 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFixed64Test.java
@@ -532,55 +532,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java
index 9bc07dc..0477e9e 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamFloatTest.java
@@ -563,55 +563,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java
index 0065870..a7f3f65 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt32Test.java
@@ -449,55 +449,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java
index 4d6d105..dc42468 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamInt64Test.java
@@ -529,55 +529,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java
index 5e49eea..1c0832e 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamObjectTest.java
@@ -391,55 +391,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java
index 75c88a4..d349ea2 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed32Test.java
@@ -431,55 +431,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java
index 4c65cf4..81a9c59 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSFixed64Test.java
@@ -531,55 +531,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java
index 6854cd8..9719444 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt32Test.java
@@ -431,55 +431,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java
index c53e9d7..118476c 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamSInt64Test.java
@@ -506,55 +506,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java
index 816d5f9..51ee78f 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamStringTest.java
@@ -287,55 +287,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java
index 50fc537..42f3e99 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt32Test.java
@@ -448,55 +448,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readLong(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
diff --git a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java
index 20969e9..8ba2c0c 100644
--- a/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java
+++ b/tests/ProtoInputStreamTests/src/com/android/test/protoinputstream/ProtoInputStreamUInt64Test.java
@@ -525,55 +525,55 @@
};
ProtoInputStream pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readFloat(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readDouble(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readInt(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBoolean(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readBytes(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}
pi = new ProtoInputStream(protobuf);
- pi.isNextField(fieldId1);
+ pi.nextField();
try {
pi.readString(fieldId1);
- fail("Should have throw IllegalArgumentException");
+ fail("Should have thrown IllegalArgumentException");
} catch (IllegalArgumentException iae) {
// good
}