okhttp3.internal.Util.isAndroidGetsocknameError()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.1k)|赞(0)|评价(0)|浏览(176)

本文整理了Java中okhttp3.internal.Util.isAndroidGetsocknameError()方法的一些代码示例,展示了Util.isAndroidGetsocknameError()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.isAndroidGetsocknameError()方法的具体详情如下:
包路径:okhttp3.internal.Util
类名称:Util
方法名:isAndroidGetsocknameError

Util.isAndroidGetsocknameError介绍

[英]Returns true if e is due to a firmware bug fixed after Android 4.2.2. https://code.google.com/p/android/issues/detail?id=54072
[中]如果e是由Android 4.2.2之后修复的固件错误引起,则返回true。https://code.google.com/p/android/issues/detail?id=54072

代码示例

代码示例来源:origin: square/okhttp

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if {@code socket} is
 * null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: square/okhttp

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (ClassCastException e) {
  // On android 8.0, socket.connect throws a ClassCastException due to a bug
  // see https://issuetracker.google.com/issues/63649622
  if (Build.VERSION.SDK_INT == 26) {
   throw new IOException("Exception in connect", e);
  } else {
   throw e;
  }
 }
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if {@code socket} is
 * null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: com.squareup.okhttp3/okhttp

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (ClassCastException e) {
  // On android 8.0, socket.connect throws a ClassCastException due to a bug
  // see https://issuetracker.google.com/issues/63649622
  if (Build.VERSION.SDK_INT == 26) {
   throw new IOException("Exception in connect", e);
  } else {
   throw e;
  }
 }
}

代码示例来源:origin: square/okhttp

success = true;
} catch (AssertionError e) {
 if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
 throw e;
} finally {

代码示例来源:origin: com.squareup.okhttp3/okhttp

success = true;
} catch (AssertionError e) {
 if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
 throw e;
} finally {

代码示例来源:origin: com.github.ljun20160606/okhttp

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if {@code socket} is
 * null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: duzechao/OKHttpUtils

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if {@code socket} is
 * null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: huxq17/SwipeCardsView

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if
 * {@code socket} is null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: apache/servicemix-bundles

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if {@code socket} is
 * null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: huxq17/tractor

/**
 * Closes {@code socket}, ignoring any checked exceptions. Does nothing if
 * {@code socket} is null.
 */
public static void closeQuietly(Socket socket) {
 if (socket != null) {
  try {
   socket.close();
  } catch (AssertionError e) {
   if (!isAndroidGetsocknameError(e)) throw e;
  } catch (RuntimeException rethrown) {
   throw rethrown;
  } catch (Exception ignored) {
  }
 }
}

代码示例来源:origin: huxq17/SwipeCardsView

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (SecurityException e) {
  // Before android 4.3, socket.connect could throw a SecurityException
  // if opening a socket resulted in an EACCES error.
  IOException ioException = new IOException("Exception in connect");
  ioException.initCause(e);
  throw ioException;
 }
}

代码示例来源:origin: duzechao/OKHttpUtils

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (SecurityException e) {
  // Before android 4.3, socket.connect could throw a SecurityException
  // if opening a socket resulted in an EACCES error.
  IOException ioException = new IOException("Exception in connect");
  ioException.initCause(e);
  throw ioException;
 }
}

代码示例来源:origin: huxq17/tractor

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (SecurityException e) {
  // Before android 4.3, socket.connect could throw a SecurityException
  // if opening a socket resulted in an EACCES error.
  IOException ioException = new IOException("Exception in connect");
  ioException.initCause(e);
  throw ioException;
 }
}

代码示例来源:origin: apache/servicemix-bundles

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (SecurityException e) {
  // Before android 4.3, socket.connect could throw a SecurityException
  // if opening a socket resulted in an EACCES error.
  IOException ioException = new IOException("Exception in connect");
  ioException.initCause(e);
  throw ioException;
 } catch (ClassCastException e) {
  // On android 8.0, socket.connect throws a ClassCastException due to a bug
  // see https://issuetracker.google.com/issues/63649622
  if (Build.VERSION.SDK_INT == 26) {
   IOException ioException = new IOException("Exception in connect");
   ioException.initCause(e);
   throw ioException;
  } else {
   throw e;
  }
 }
}

代码示例来源:origin: com.github.ljun20160606/okhttp

@Override public void connectSocket(Socket socket, InetSocketAddress address,
  int connectTimeout) throws IOException {
 try {
  socket.connect(address, connectTimeout);
 } catch (AssertionError e) {
  if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
  throw e;
 } catch (SecurityException e) {
  // Before android 4.3, socket.connect could throw a SecurityException
  // if opening a socket resulted in an EACCES error.
  IOException ioException = new IOException("Exception in connect");
  ioException.initCause(e);
  throw ioException;
 } catch (ClassCastException e) {
  // On android 8.0, socket.connect throws a ClassCastException due to a bug
  // see https://issuetracker.google.com/issues/63649622
  if (Build.VERSION.SDK_INT == 26) {
   IOException ioException = new IOException("Exception in connect");
   ioException.initCause(e);
   throw ioException;
  } else {
   throw e;
  }
 }
}

代码示例来源:origin: com.github.ljun20160606/okhttp

success = true;
} catch (AssertionError e) {
 if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
 throw e;
} finally {

代码示例来源:origin: huxq17/SwipeCardsView

success = true;
} catch (AssertionError e) {
 if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
 throw e;
} finally {

代码示例来源:origin: apache/servicemix-bundles

success = true;
} catch (AssertionError e) {
 if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
 throw e;
} finally {

代码示例来源:origin: duzechao/OKHttpUtils

success = true;
} catch (AssertionError e) {
 if (Util.isAndroidGetsocknameError(e)) throw new IOException(e);
 throw e;
} finally {

相关文章