Remove deprecated methods with Guava 20 release

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137849843
This commit is contained in:
jianglai 2016-11-01 11:39:34 -07:00 committed by Ben McIlwain
parent 73e88b2391
commit 82b0bff9b5
14 changed files with 34 additions and 29 deletions

View file

@ -76,7 +76,7 @@ public class TlsCredentials implements TransportCredentials {
static InetAddress parseInetAddress(String asciiAddr) {
try {
return InetAddresses.forString(HostAndPort.fromString(asciiAddr).getHostText());
return InetAddresses.forString(HostAndPort.fromString(asciiAddr).getHost());
} catch (IllegalArgumentException e) {
return null;
}

View file

@ -14,8 +14,8 @@
package google.registry.model;
import static com.google.common.base.Predicates.assignableFrom;
import static com.google.common.base.Predicates.or;
import static com.google.common.base.Predicates.subtypeOf;
import com.google.common.base.Function;
import com.google.common.base.Joiner;
@ -61,7 +61,7 @@ public final class SchemaVersion {
*/
public static String getSchema() {
return FluentIterable.from(getAllPersistedTypes())
.filter(or(assignableFrom(Enum.class), assignableFrom(ImmutableObject.class)))
.filter(or(subtypeOf(Enum.class), subtypeOf(ImmutableObject.class)))
.transform(new Function<Class<?>, String>() {
@Override
public String apply(Class<?> clazz) {

View file

@ -193,7 +193,8 @@ public class Lock extends ImmutableObject {
TimeUnit.MILLISECONDS,
true);
} catch (Exception e) {
throw Throwables.propagate(e);
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}

View file

@ -97,7 +97,7 @@ final class Router {
} catch (InvocationTargetException e) {
// This means an exception was thrown during the injection process while instantiating
// the @Action class; we should propagate that underlying exception.
Throwables.propagateIfPossible(e.getCause());
Throwables.throwIfUnchecked(e.getCause());
throw new AssertionError(
"Component's @Action factory method somehow threw checked exception", e);
}

View file

@ -14,7 +14,7 @@
package google.registry.tmch;
import static com.google.common.base.Throwables.propagateIfInstanceOf;
import static com.google.common.base.Throwables.throwIfInstanceOf;
import static google.registry.util.CacheUtils.memoizeWithLongExpiration;
import static google.registry.util.CacheUtils.memoizeWithShortExpiration;
import static google.registry.util.ResourceUtils.readResourceUtf8;
@ -125,7 +125,7 @@ public final class TmchCertificateAuthority {
try {
return ROOT_CACHE.get();
} catch (RuntimeException e) {
propagateIfInstanceOf(e.getCause(), GeneralSecurityException.class);
throwIfInstanceOf(e.getCause(), GeneralSecurityException.class);
throw e;
}
}
@ -134,7 +134,7 @@ public final class TmchCertificateAuthority {
try {
return CRL_CACHE.get();
} catch (RuntimeException e) {
propagateIfInstanceOf(e.getCause(), GeneralSecurityException.class);
throwIfInstanceOf(e.getCause(), GeneralSecurityException.class);
throw e;
}
}

View file

@ -17,7 +17,7 @@ package google.registry.tmch;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.getRootCause;
import static com.google.common.base.Throwables.propagateIfInstanceOf;
import static com.google.common.base.Throwables.throwIfInstanceOf;
import static google.registry.xml.XmlTransformer.loadXmlSchemas;
import com.google.common.collect.ImmutableList;
@ -96,7 +96,7 @@ public final class TmchXmlSignature {
isValid = signature.validate(context);
} catch (XMLSignatureException e) {
Throwable cause = getRootCause(e);
propagateIfInstanceOf(cause, GeneralSecurityException.class);
throwIfInstanceOf(cause, GeneralSecurityException.class);
throw e;
}
if (!isValid) {

View file

@ -163,7 +163,7 @@ class AppEngineConnection implements Connection {
}
boolean isLocalhost() {
return server.getHostText().equals("localhost");
return server.getHost().equals("localhost");
}
private String getUserId() {

View file

@ -129,7 +129,7 @@ final class RegistryCli {
// RemoteApiCommands need to have the remote api installed to work.
RemoteApiInstaller installer = new RemoteApiInstaller();
RemoteApiOptions options = new RemoteApiOptions();
options.server(connection.getServer().getHostText(), connection.getServer().getPort());
options.server(connection.getServer().getHost(), connection.getServer().getPort());
if (connection.isLocalhost()) {
// Use dev credentials for localhost.
options.useDevelopmentServerCredential();

View file

@ -16,7 +16,7 @@ package google.registry.util;
import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.common.base.Throwables.propagateIfInstanceOf;
import static com.google.common.base.Throwables.throwIfInstanceOf;
import static com.google.common.io.BaseEncoding.base64;
import static java.nio.charset.StandardCharsets.US_ASCII;
@ -76,7 +76,7 @@ public final class X509Utils {
.from(CertificateFactory.getInstance("X.509").generateCertificates(input))
.filter(X509Certificate.class));
} catch (CertificateException e) { // CertificateParsingException by specification.
propagateIfInstanceOf(e, CertificateParsingException.class);
throwIfInstanceOf(e, CertificateParsingException.class);
throw new CertificateParsingException(e);
} catch (NoSuchElementException e) {
throw new CertificateParsingException("No X509Certificate found.");

View file

@ -14,7 +14,7 @@
package google.registry.xml;
import static com.google.common.base.Throwables.propagateIfInstanceOf;
import static com.google.common.base.Throwables.throwIfInstanceOf;
import static com.google.common.base.Verify.verify;
import static java.nio.charset.StandardCharsets.UTF_8;
@ -74,7 +74,7 @@ public final class XmlFragmentMarshaller {
try {
marshaller.marshal(element, os);
} catch (JAXBException e) {
propagateIfInstanceOf(e, MarshalException.class);
throwIfInstanceOf(e, MarshalException.class);
throw new RuntimeException("Mysterious XML exception", e);
}
String fragment = new String(os.toByteArray(), UTF_8);