summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2020-06-18 07:59:34 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-06-18 07:59:34 +0000
commitfecc0bfbd60c4399a7a6e6ee6bd0e3d7f98a47cd (patch)
treece905fb97d286c37c7706d9e2b4f5e8f499362dc
parent9c384e13082e100cd6b493a4a66655f22dce2295 (diff)
parent95f08e0ff9766bcbb6c97d41ab4f3bb99dad6c51 (diff)
Merge "Fix the potential NPE when calling IPMS API and ExecutionException is thrown." into rvc-dev am: f6d4760cd5 am: 95f08e0ff9
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/modules/NetworkStack/+/11882394 Change-Id: Id1c0f16e33f0d512a71358478d9f40ee872c4569
-rw-r--r--common/networkstackclient/src/android/net/IpMemoryStoreClient.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/common/networkstackclient/src/android/net/IpMemoryStoreClient.java b/common/networkstackclient/src/android/net/IpMemoryStoreClient.java
index f269f9c..a1c5694 100644
--- a/common/networkstackclient/src/android/net/IpMemoryStoreClient.java
+++ b/common/networkstackclient/src/android/net/IpMemoryStoreClient.java
@@ -92,6 +92,7 @@ public abstract class IpMemoryStoreClient {
() -> service.storeNetworkAttributes(l2Key, attributes.toParcelable(),
OnStatusListener.toAIDL(listener))));
} catch (ExecutionException m) {
+ if (null == listener) return;
ignoringRemoteException("Error storing network attributes",
() -> listener.onComplete(new Status(Status.ERROR_UNKNOWN)));
}
@@ -116,6 +117,7 @@ public abstract class IpMemoryStoreClient {
() -> service.storeBlob(l2Key, clientId, name, data,
OnStatusListener.toAIDL(listener))));
} catch (ExecutionException m) {
+ if (null == listener) return;
ignoringRemoteException("Error storing blob",
() -> listener.onComplete(new Status(Status.ERROR_UNKNOWN)));
}
@@ -143,7 +145,8 @@ public abstract class IpMemoryStoreClient {
OnL2KeyResponseListener.toAIDL(listener))));
} catch (ExecutionException m) {
ignoringRemoteException("Error finding L2 Key",
- () -> listener.onL2KeyResponse(new Status(Status.ERROR_UNKNOWN), null));
+ () -> listener.onL2KeyResponse(new Status(Status.ERROR_UNKNOWN),
+ null /* l2Key */));
}
}
@@ -164,7 +167,8 @@ public abstract class IpMemoryStoreClient {
OnSameL3NetworkResponseListener.toAIDL(listener))));
} catch (ExecutionException m) {
ignoringRemoteException("Error checking for network sameness",
- () -> listener.onSameL3NetworkResponse(new Status(Status.ERROR_UNKNOWN), null));
+ () -> listener.onSameL3NetworkResponse(new Status(Status.ERROR_UNKNOWN),
+ null /* response */));
}
}
@@ -186,7 +190,7 @@ public abstract class IpMemoryStoreClient {
} catch (ExecutionException m) {
ignoringRemoteException("Error retrieving network attributes",
() -> listener.onNetworkAttributesRetrieved(new Status(Status.ERROR_UNKNOWN),
- null, null));
+ null /* l2Key */, null /* attributes */));
}
}
@@ -210,7 +214,7 @@ public abstract class IpMemoryStoreClient {
} catch (ExecutionException m) {
ignoringRemoteException("Error retrieving blob",
() -> listener.onBlobRetrieved(new Status(Status.ERROR_UNKNOWN),
- null, null, null));
+ null /* l2Key */, null /* name */, null /* blob */));
}
}
@@ -235,6 +239,7 @@ public abstract class IpMemoryStoreClient {
runWhenServiceReady(service -> ignoringRemoteException(() ->
service.delete(l2Key, needWipe, OnDeleteStatusListener.toAIDL(listener))));
} catch (ExecutionException m) {
+ if (null == listener) return;
ignoringRemoteException("Error deleting from the memory store",
() -> listener.onComplete(new Status(Status.ERROR_UNKNOWN),
0 /* deletedRecords */));
@@ -266,6 +271,7 @@ public abstract class IpMemoryStoreClient {
() -> service.deleteCluster(cluster, needWipe,
OnDeleteStatusListener.toAIDL(listener))));
} catch (ExecutionException m) {
+ if (null == listener) return;
ignoringRemoteException("Error deleting from the memory store",
() -> listener.onComplete(new Status(Status.ERROR_UNKNOWN),
0 /* deletedRecords */));