diff options
author | 2024-06-05 14:42:12 -0700 | |
---|---|---|
committer | 2024-06-05 14:55:02 -0700 | |
commit | f7105afe1aa6de129cddf19fe7d4d99586923d2d (patch) | |
tree | 1b6b790a1dc3c4fe6b0fc8306983a833dd588f71 /ravenwood/runtime-helper-src | |
parent | 899fcff3db9c460ce2c9378f49918eef7a12c421 (diff) |
Parcel_host.java: match Parcel.java error conditions better
Parcel.java throws an IllegalArgumentException when setDataCapacity()
is called with a negative size, whereas Parcel_host.java silently
ignores the invalid value. Modify Parcel_host.java to behave
the same as Parcel.java
Test: atest CtsOsTestCasesRavenwood:ParcelTest\#testSetDataCapacityNegative
Test: atest CtsOsTestCases:ParcelTest\#testSetDataCapacityNegative
Flag: TEST_ONLY
Bug: 345293489
Change-Id: I2a60da0da7b587a8e08cb09546d5b4ad83f05817
Diffstat (limited to 'ravenwood/runtime-helper-src')
-rw-r--r-- | ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java index 61ec7b4bbc72..22e11e18ae31 100644 --- a/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java +++ b/ravenwood/runtime-helper-src/framework/com/android/platform/test/ravenwood/nativesubstitution/Parcel_host.java @@ -164,6 +164,9 @@ public class Parcel_host { p.mPos = pos; } public static void nativeSetDataCapacity(long nativePtr, int size) { + if (size < 0) { + throw new IllegalArgumentException("size < 0: size=" + size); + } var p = getInstance(nativePtr); if (p.getCapacity() < size) { p.forceSetCapacity(size); |