commit | 169b7a63c9296625b6e711e216a487a383fe91f4 | [log] [tgz] |
---|---|---|
author | Pavel Maltsev <pavelm@google.com> | Tue Jan 26 15:56:07 2016 -0800 |
committer | Pavel Maltsev <pavelm@google.com> | Sat Jan 30 02:06:55 2016 +0000 |
tree | d44307383aa6b788df30cb3a42c060e904254cac | |
parent | acee0fa328dd2f63f032eb79328dfa8569d4d903 [diff] |
Handle custom properties in VNS Throw an exception if VehicleNetwork#getProperty(int) called for custom property because data type is undefined. Bug:26729379 Change-Id: I78de2e1059d5c275e828c6ff4b41d4424c7feb6f
diff --git a/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java b/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java index 48b62b0..5925e9b 100644 --- a/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java +++ b/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java
@@ -270,6 +270,9 @@ */ public VehiclePropValue getProperty(int property) throws IllegalArgumentException { int valueType = VehicleNetworkConsts.getVehicleValueType(property); + if (valueType == 0) { + throw new IllegalArgumentException("Data type is unknown for property: " + property); + } VehiclePropValue value = VehiclePropValueUtil.createBuilder(property, valueType, 0).build(); return getProperty(value); }