Merge "Fix the potential NullPointerException." am: 4b5c8e1076 am: e15f92e37f

am: 590bf9a468

Change-Id: I62ba307387c2f6faff11ea44f86f3ea1c90c38a2
This commit is contained in:
Xiao Ma
2019-06-08 04:47:29 -07:00
committed by android-build-merger
2 changed files with 6 additions and 3 deletions

View File

@@ -127,6 +127,7 @@ public class NetworkAttributes {
@Nullable @Nullable
private static InetAddress getByAddressOrNull(@Nullable final byte[] address) { private static InetAddress getByAddressOrNull(@Nullable final byte[] address) {
if (null == address) return null;
try { try {
return InetAddress.getByAddress(address); return InetAddress.getByAddress(address);
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
@@ -227,7 +228,9 @@ public class NetworkAttributes {
} }
/** /**
* Set the lease expiry timestamp of assigned v4 address. * Set the lease expiry timestamp of assigned v4 address. Long.MAX_VALUE is used
* to represent "infinite lease".
*
* @param assignedV4AddressExpiry The lease expiry timestamp of assigned v4 address. * @param assignedV4AddressExpiry The lease expiry timestamp of assigned v4 address.
* @return This builder. * @return This builder.
*/ */

View File

@@ -40,8 +40,8 @@ public interface OnNetworkAttributesRetrievedListener {
// NonNull, but still don't crash the system server if null // NonNull, but still don't crash the system server if null
if (null != listener) { if (null != listener) {
listener.onNetworkAttributesRetrieved( listener.onNetworkAttributesRetrieved(
new Status(statusParcelable), l2Key, new Status(statusParcelable), l2Key, null == networkAttributesParcelable
new NetworkAttributes(networkAttributesParcelable)); ? null : new NetworkAttributes(networkAttributesParcelable));
} }
} }