mirror of
https://github.com/google/nomulus.git
synced 2025-07-21 18:26:12 +02:00
Remove deprecated methods with Guava 20 release
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=137849843
This commit is contained in:
parent
73e88b2391
commit
82b0bff9b5
14 changed files with 34 additions and 29 deletions
|
@ -62,9 +62,10 @@ public final class ServletWrapperDelegatorServlet extends HttpServlet {
|
|||
try {
|
||||
Uninterruptibles.getUninterruptibly(task);
|
||||
} catch (ExecutionException e) {
|
||||
Throwables.propagateIfInstanceOf(e.getCause(), ServletException.class);
|
||||
Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
|
||||
throw Throwables.propagate(e.getCause());
|
||||
Throwables.throwIfInstanceOf(e.getCause(), ServletException.class);
|
||||
Throwables.throwIfInstanceOf(e.getCause(), IOException.class);
|
||||
Throwables.throwIfUnchecked(e.getCause());
|
||||
throw new RuntimeException(e.getCause());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,7 +91,8 @@ public final class TestServer {
|
|||
try {
|
||||
server.start();
|
||||
} catch (Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
Throwables.throwIfUnchecked(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
UrlChecker.waitUntilAvailable(getUrl("/healthz"), STARTUP_TIMEOUT_MS);
|
||||
}
|
||||
|
@ -129,7 +130,8 @@ public final class TestServer {
|
|||
}
|
||||
}, SHUTDOWN_TIMEOUT_MS, TimeUnit.MILLISECONDS, true);
|
||||
} catch (Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
Throwables.throwIfUnchecked(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -166,20 +168,20 @@ public final class TestServer {
|
|||
|
||||
private static Connector createConnector(HostAndPort address) {
|
||||
SocketConnector connector = new SocketConnector();
|
||||
connector.setHost(address.getHostText());
|
||||
connector.setHost(address.getHost());
|
||||
connector.setPort(address.getPortOrDefault(DEFAULT_PORT));
|
||||
return connector;
|
||||
}
|
||||
|
||||
/** Converts a bind address into an address that other machines can use to connect here. */
|
||||
private static HostAndPort createUrlAddress(HostAndPort address) {
|
||||
if (address.getHostText().equals("::") || address.getHostText().equals("0.0.0.0")) {
|
||||
if (address.getHost().equals("::") || address.getHost().equals("0.0.0.0")) {
|
||||
return address.getPortOrDefault(DEFAULT_PORT) == DEFAULT_PORT
|
||||
? HostAndPort.fromHost(getCanonicalHostName())
|
||||
: HostAndPort.fromParts(getCanonicalHostName(), address.getPort());
|
||||
} else {
|
||||
return address.getPortOrDefault(DEFAULT_PORT) == DEFAULT_PORT
|
||||
? HostAndPort.fromHost(address.getHostText())
|
||||
? HostAndPort.fromHost(address.getHost())
|
||||
: address;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ final class UrlChecker {
|
|||
}
|
||||
}, timeoutMs, TimeUnit.MILLISECONDS, true);
|
||||
} catch (Exception e) {
|
||||
throw Throwables.propagate(e);
|
||||
Throwables.throwIfUnchecked(e);
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,25 +28,25 @@ public class HostAndPortParameterTest {
|
|||
|
||||
@Test
|
||||
public void testConvert_hostOnly() throws Exception {
|
||||
assertThat(instance.convert("foo.bar").getHostText()).isEqualTo("foo.bar");
|
||||
assertThat(instance.convert("foo.bar").getHost()).isEqualTo("foo.bar");
|
||||
assertThat(instance.convert("foo.bar").getPortOrDefault(31337)).isEqualTo(31337);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert_hostAndPort() throws Exception {
|
||||
assertThat(instance.convert("foo.bar:1234").getHostText()).isEqualTo("foo.bar");
|
||||
assertThat(instance.convert("foo.bar:1234").getHost()).isEqualTo("foo.bar");
|
||||
assertThat(instance.convert("foo.bar:1234").getPortOrDefault(31337)).isEqualTo(1234);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert_ipv6_hostOnly() throws Exception {
|
||||
assertThat(instance.convert("[feed:a:bee]").getHostText()).isEqualTo("feed:a:bee");
|
||||
assertThat(instance.convert("[feed:a:bee]").getHost()).isEqualTo("feed:a:bee");
|
||||
assertThat(instance.convert("[feed:a:bee]").getPortOrDefault(31337)).isEqualTo(31337);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConvert_ipv6_hostAndPort() throws Exception {
|
||||
assertThat(instance.convert("[feed:a:bee]:1234").getHostText()).isEqualTo("feed:a:bee");
|
||||
assertThat(instance.convert("[feed:a:bee]:1234").getHost()).isEqualTo("feed:a:bee");
|
||||
assertThat(instance.convert("[feed:a:bee]:1234").getPortOrDefault(31337)).isEqualTo(1234);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue