summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrad Ebinger <breadley@google.com>2021-04-21 17:55:02 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2021-04-21 17:55:02 +0000
commit7e8765d37ac321e90b5dada264b92b32bff6deac (patch)
tree004ae8b0373884e8c25f4b9df1113cf0ca38dc89
parent6e1db3d577783b5e7f5ee5c8f693a639ca9dfe13 (diff)
parent9a880b4f395c5f23990056e3412a976ab2d7aa70 (diff)
Merge "Throw NPE instead of IllegalArgumentException in SipDelegateManager" am: 5733e616fb am: aff57e7818 am: 9a880b4f39
Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1675740 Change-Id: Ib1daec20b74e0225645a53588e72b4f57c78d1cf
-rw-r--r--telephony/java/android/telephony/ims/SipDelegateManager.java17
1 files changed, 7 insertions, 10 deletions
diff --git a/telephony/java/android/telephony/ims/SipDelegateManager.java b/telephony/java/android/telephony/ims/SipDelegateManager.java
index 171842b26cb0..77fe75a8d338 100644
--- a/telephony/java/android/telephony/ims/SipDelegateManager.java
+++ b/telephony/java/android/telephony/ims/SipDelegateManager.java
@@ -39,6 +39,7 @@ import com.android.internal.annotations.VisibleForTesting;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
+import java.util.Objects;
import java.util.concurrent.Executor;
/**
@@ -322,9 +323,10 @@ public class SipDelegateManager {
public void createSipDelegate(@NonNull DelegateRequest request, @NonNull Executor executor,
@NonNull DelegateConnectionStateCallback dc,
@NonNull DelegateConnectionMessageCallback mc) throws ImsException {
- if (request == null || executor == null || dc == null || mc == null) {
- throw new IllegalArgumentException("Invalid arguments passed into createSipDelegate");
- }
+ Objects.requireNonNull(request, "The DelegateRequest must not be null.");
+ Objects.requireNonNull(executor, "The Executor must not be null.");
+ Objects.requireNonNull(dc, "The DelegateConnectionStateCallback must not be null.");
+ Objects.requireNonNull(mc, "The DelegateConnectionMessageCallback must not be null.");
try {
SipDelegateConnectionAidlWrapper wrapper =
new SipDelegateConnectionAidlWrapper(executor, dc, mc);
@@ -355,10 +357,7 @@ public class SipDelegateManager {
@RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void destroySipDelegate(@NonNull SipDelegateConnection delegateConnection,
@SipDelegateDestroyReason int reason) {
-
- if (delegateConnection == null) {
- throw new IllegalArgumentException("invalid argument passed into destroySipDelegate");
- }
+ Objects.requireNonNull(delegateConnection, "SipDelegateConnection can not be null.");
if (delegateConnection instanceof SipDelegateConnectionAidlWrapper) {
SipDelegateConnectionAidlWrapper w =
(SipDelegateConnectionAidlWrapper) delegateConnection;
@@ -396,9 +395,7 @@ public class SipDelegateManager {
@RequiresPermission(Manifest.permission.PERFORM_IMS_SINGLE_REGISTRATION)
public void triggerFullNetworkRegistration(@NonNull SipDelegateConnection connection,
@IntRange(from = 100, to = 699) int sipCode, @Nullable String sipReason) {
- if (connection == null) {
- throw new IllegalArgumentException("invalid connection.");
- }
+ Objects.requireNonNull(connection, "SipDelegateConnection can not be null.");
if (connection instanceof SipDelegateConnectionAidlWrapper) {
SipDelegateConnectionAidlWrapper w = (SipDelegateConnectionAidlWrapper) connection;
try {