From 07051bcd834ce0325134b6518d80bb7569d5e821 Mon Sep 17 00:00:00 2001 From: Remi NGUYEN VAN Date: Thu, 11 Mar 2021 07:43:37 +0000 Subject: [PATCH] Remove usage of hidden InetSocketAddress constructor The constructor is a hidden API, and used in a code path that can never happen. Replace it with a thrown exception (which should never be thrown either). Bug: 170598012 Change-Id: Ie2c671c1a75accb8e94b08de9901d14b72caaf7e Test: m --- framework/src/android/net/QosSocketInfo.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/src/android/net/QosSocketInfo.java b/framework/src/android/net/QosSocketInfo.java index d37c4691dd..c345a9d77d 100644 --- a/framework/src/android/net/QosSocketInfo.java +++ b/framework/src/android/net/QosSocketInfo.java @@ -114,10 +114,10 @@ public final class QosSocketInfo implements Parcelable { try { return new InetSocketAddress(InetAddress.getByAddress(address), port); } catch (final UnknownHostException e) { - /* The catch block was purposely left empty. UnknownHostException will never be thrown + /* This can never happen. UnknownHostException will never be thrown since the address provided is numeric and non-null. */ + throw new RuntimeException("UnknownHostException on numeric address", e); } - return new InetSocketAddress(); } @Override