From d7e24381a3879e8d5afacf309deee50278f79243 Mon Sep 17 00:00:00 2001 From: jwilson Date: Fri, 10 May 2013 19:53:12 -0400 Subject: [PATCH] Don't explode if NetworkInterface.getByInetAddress does. Certain Motorola RAZRs always throw a SocketException when you call that method. We don't _really_ need a perfect MTU, so for those devices just return the default MTU. --- .../src/main/java/com/squareup/okhttp/internal/Platform.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java b/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java index cabe82672..b1e7e5363 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java +++ b/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java @@ -205,6 +205,9 @@ public class Platform { return super.getMtu(socket); // There's no longer an interface with this local address. } return (Integer) getMtu.invoke(networkInterface); + } catch (SocketException e) { + // Certain Motorola devices always throw on getByInetAddress. Return the default for those. + return super.getMtu(socket); } catch (IllegalAccessException e) { throw new AssertionError(e); } catch (InvocationTargetException e) {