RaResponder: log instead of throw exception
Throwing an exception in RaResponder crashes the test process (as it
runs in a secondary thread). This is not very useful as that will fail
the execution of all the other tests.
Adding a log statement instead of throwing an exception makes more sense
as the tests will most likely fail anyways.
Test: atest EthernetManagerTest
Change-Id: I9c5f5dc417dad7df1c7f729caa4e0259ed71591f
diff --git a/staticlibs/testutils/devicetests/com/android/testutils/RouterAdvertisementResponder.java b/staticlibs/testutils/devicetests/com/android/testutils/RouterAdvertisementResponder.java
index 21cb149..478161d 100644
--- a/staticlibs/testutils/devicetests/com/android/testutils/RouterAdvertisementResponder.java
+++ b/staticlibs/testutils/devicetests/com/android/testutils/RouterAdvertisementResponder.java
@@ -35,6 +35,7 @@
import android.net.LinkAddress;
import android.net.MacAddress;
import android.util.ArrayMap;
+import android.util.Log;
import android.util.Pair;
import com.android.net.module.util.Ipv6Utils;
@@ -130,7 +131,9 @@
try {
reader.sendResponse(buffer);
} catch (IOException e) {
- throw new RuntimeException("Failed to send buffer.");
+ // Throwing an exception here will crash the test process. Let's stick to logging, as
+ // the test will fail either way.
+ Log.e(TAG, "Failed to send buffer", e);
}
}