private List<InetAddress> throwBestFailure(String hostname, List<Exception> failures) throws UnknownHostException { if (failures.size() == 0) { throw new UnknownHostException(hostname); } Exception failure = failures.get(0); if (failure instanceof UnknownHostException) { throw (UnknownHostException) failure; } UnknownHostException unknownHostException = new UnknownHostException(hostname); unknownHostException.initCause(failure); for (int i = 1; i < failures.size(); i++) { Util.addSuppressedIfPossible(unknownHostException, failures.get(i)); } throw unknownHostException; }
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
UnknownHostException unknownHostException = new UnknownHostException("Failed to determine LAN address"); unknownHostException.initCause(e); throw unknownHostException;
@Override public List<InetAddress> lookup(String hostname) throws UnknownHostException { if (hostname == null) throw new UnknownHostException("hostname == null"); InetAddress inetAddress = hosts.get(hostname); if (inetAddress != null) { return Collections.singletonList(inetAddress); } if (Settings.getBuiltInHosts()) { inetAddress = builtInHosts.get(hostname); if (inetAddress != null) { return Collections.singletonList(inetAddress); } } try { return Arrays.asList(InetAddress.getAllByName(hostname)); } catch (NullPointerException e) { UnknownHostException unknownHostException = new UnknownHostException("Broken system behaviour for dns lookup of " + hostname); unknownHostException.initCause(e); throw unknownHostException; } } }
unknownHostException.initCause(cause);
unknownHostException.initCause(cause);
if (Internal.instance.isInvalidHttpUrlHost(e)) { UnknownHostException unknownHost = new UnknownHostException(); unknownHost.initCause(e); throw unknownHost;
new UnknownHostException( "Failed to determine LAN address: " + e); unknownHostException.initCause(e); throw unknownHostException;
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
public UnknownHostException rethrowAsUnknownHostException(String detailMessage) throws UnknownHostException { UnknownHostException newException = new UnknownHostException(detailMessage); newException.initCause(this); throw newException; }
@Override public List<InetAddress> lookup(String hostname) throws UnknownHostException { if (hostname == null) throw new UnknownHostException("hostname == null"); try { return Arrays.asList(InetAddress.getAllByName(hostname)); } catch (NullPointerException e) { UnknownHostException unknownHostException = new UnknownHostException("Broken system behaviour for dns lookup of " + hostname); unknownHostException.initCause(e); throw unknownHostException; } } };
@Override public List<InetAddress> lookup(String hostname) throws UnknownHostException { if (hostname == null) throw new UnknownHostException("hostname == null"); try { return Arrays.asList(InetAddress.getAllByName(hostname)); } catch (NullPointerException e) { UnknownHostException unknownHostException = new UnknownHostException("Broken system behaviour for dns lookup of " + hostname); unknownHostException.initCause(e); throw unknownHostException; } } };
public static int toInt(String ipAddress) throws UnknownHostException { InetAddress inetAddress; try { inetAddress = InetAddress.getByName(ipAddress); return ByteBuffer.wrap(inetAddress.getAddress()).getInt(); } catch (Exception e) { UnknownHostException unknownHostException = new UnknownHostException( "Failed to determine LAN address: " + e); unknownHostException.initCause(e); throw unknownHostException; } }
public static int toInt(String ipAddress) throws UnknownHostException { InetAddress inetAddress; try { inetAddress = InetAddress.getByName(ipAddress); return ByteBuffer.wrap(inetAddress.getAddress()).getInt(); } catch (Exception e) { UnknownHostException unknownHostException = new UnknownHostException( "Failed to determine LAN address: " + e); unknownHostException.initCause(e); throw unknownHostException; } }
private List<InetAddress> throwBestFailure(String hostname, List<Exception> failures) throws UnknownHostException { if (failures.size() == 0) { throw new UnknownHostException(hostname); } Exception failure = failures.get(0); if (failure instanceof UnknownHostException) { throw (UnknownHostException) failure; } UnknownHostException unknownHostException = new UnknownHostException(hostname); unknownHostException.initCause(failure); for (int i = 1; i < failures.size(); i++) { Util.addSuppressedIfPossible(unknownHostException, failures.get(i)); } throw unknownHostException; }
@Override protected AFUNIXSocketAddress addressFromHost(String host, int port) throws IOException { host = stripBrackets(host); if (host.startsWith(FILE_SCHEME_PREFIX_ENCODED)) { try { host = URLDecoder.decode(host, "UTF-8"); } catch (Exception e) { throw (UnknownHostException) new UnknownHostException().initCause(e); } } if (!host.startsWith(FILE_SCHEME_PREFIX)) { throw new UnknownHostException(); } String path = host.substring(FILE_SCHEME_PREFIX.length()); if (path.isEmpty()) { throw new UnknownHostException(); } if (path.startsWith(FILE_SCHEME_LOCALHOST)) { path = path.substring(FILE_SCHEME_LOCALHOST.length()); } if (!path.startsWith("/")) { throw new UnknownHostException(); } File socketFile = new File(path); return new AFUNIXSocketAddress(socketFile, port); } }