Merge changes from topic 'guava-20.0'

* changes:
  Remove usage of to-be-deprecated Throwables
  Update Guava to 20.0 snapshot version 20160818.201422-323


*submodules:
* Update plugins/replication from branch 'master'
  - Remove usage of to-be-deprecated Throwables methods
    
    The propagate and propagateIfPossible methods will be deprecated
    in Guava 20. Replace them with the recommended alternatives.
    
    Change-Id: I11d8adcae3000189c16f60179e02a79440ef99d6
This commit is contained in:
David Ostrovsky
2016-08-23 04:15:16 +00:00
committed by Gerrit Code Review
19 changed files with 25 additions and 24 deletions

View File

@@ -377,7 +377,7 @@ public class LuceneChangeIndex implements ChangeIndex {
close();
throw new OrmRuntimeException(e);
} catch (ExecutionException e) {
Throwables.propagateIfPossible(e.getCause());
Throwables.throwIfUnchecked(e.getCause());
throw new OrmRuntimeException(e.getCause());
}
}

View File

@@ -94,7 +94,7 @@ public class AccountLoader {
directory.fillAccountInfo(
Iterables.concat(created.values(), provided), options);
} catch (DirectoryException e) {
Throwables.propagateIfPossible(e.getCause(), OrmException.class);
Throwables.throwIfInstanceOf(e.getCause(), OrmException.class);
throw new OrmException(e);
}
}

View File

@@ -47,7 +47,7 @@ public class GetDetail implements RestReadView<AccountResource> {
directory.fillAccountInfo(Collections.singleton(info),
EnumSet.allOf(FillOptions.class));
} catch (DirectoryException e) {
Throwables.propagateIfPossible(e.getCause(), OrmException.class);
Throwables.throwIfInstanceOf(e.getCause(), OrmException.class);
throw new OrmException(e);
}
return info;

View File

@@ -154,8 +154,8 @@ import javax.security.auth.login.LoginException;
}
});
} catch (PrivilegedActionException e) {
Throwables.propagateIfPossible(e.getException(), NamingException.class);
Throwables.propagateIfPossible(e.getException(), RuntimeException.class);
Throwables.throwIfInstanceOf(e.getException(), NamingException.class);
Throwables.throwIfInstanceOf(e.getException(), RuntimeException.class);
LdapRealm.log.warn("Internal error", e.getException());
return null;
} finally {

View File

@@ -267,7 +267,7 @@ public class ChangeJson {
} catch (PatchListNotAvailableException | GpgException | OrmException
| IOException | RuntimeException e) {
if (!has(CHECK)) {
Throwables.propagateIfPossible(e, OrmException.class);
Throwables.throwIfInstanceOf(e, OrmException.class);
throw new OrmException(e);
}
return checkOnly(cd);

View File

@@ -464,7 +464,7 @@ public class BatchUpdate implements AutoCloseable {
throw new ResourceNotFoundException(e.getMessage(), e);
} catch (Exception e) {
Throwables.propagateIfPossible(e);
Throwables.throwIfUnchecked(e);
throw new UpdateException(e);
}
}
@@ -669,7 +669,7 @@ public class BatchUpdate implements AutoCloseable {
logDebug("No objects to flush");
}
} catch (Exception e) {
Throwables.propagateIfPossible(e, RestApiException.class);
Throwables.throwIfInstanceOf(e, RestApiException.class);
throw new UpdateException(e);
}
}
@@ -744,8 +744,8 @@ public class BatchUpdate implements AutoCloseable {
maybeLogSlowUpdate(startNanos, "NoteDb");
}
} catch (ExecutionException | InterruptedException e) {
Throwables.propagateIfInstanceOf(e.getCause(), UpdateException.class);
Throwables.propagateIfInstanceOf(e.getCause(), RestApiException.class);
Throwables.throwIfInstanceOf(e.getCause(), UpdateException.class);
Throwables.throwIfInstanceOf(e.getCause(), RestApiException.class);
throw new UpdateException(e);
} catch (OrmException | IOException e) {
throw new UpdateException(e);

View File

@@ -197,7 +197,7 @@ public class RepoSequence {
limit = counter + count;
acquireCount++;
} catch (ExecutionException | RetryException e) {
Throwables.propagateIfInstanceOf(e.getCause(), OrmException.class);
Throwables.throwIfInstanceOf(e.getCause(), OrmException.class);
throw new OrmException(e);
} catch (IOException e) {
throw new OrmException(e);

View File

@@ -93,7 +93,7 @@ class IntraLineLoader implements Callable<IntraLineDiff> {
} catch (ExecutionException e) {
// If there was an error computing the result, carry it
// up to the caller so the cache knows this key is invalid.
Throwables.propagateIfInstanceOf(e.getCause(), Exception.class);
Throwables.throwIfInstanceOf(e.getCause(), Exception.class);
throw new Exception(e.getMessage(), e.getCause());
}
}

View File

@@ -260,7 +260,7 @@ public class PatchListLoader implements Callable<PatchList> {
} catch (ExecutionException e) {
// If there was an error computing the result, carry it
// up to the caller so the cache knows this key is invalid.
Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
Throwables.throwIfInstanceOf(e.getCause(), IOException.class);
throw new IOException(e.getMessage(), e.getCause());
}
}

View File

@@ -148,7 +148,7 @@ public class ProjectCacheImpl implements ProjectCache {
} catch (ExecutionException e) {
if (!(e.getCause() instanceof RepositoryNotFoundException)) {
log.warn(String.format("Cannot read project %s", projectName.get()), e);
Throwables.propagateIfInstanceOf(e.getCause(), IOException.class);
Throwables.throwIfInstanceOf(e.getCause(), IOException.class);
throw new IOException(e);
}
return null;

View File

@@ -49,7 +49,7 @@ public class RefPattern {
try {
return exampleCache.get(refPattern);
} catch (ExecutionException e) {
Throwables.propagateIfPossible(e.getCause());
Throwables.throwIfUnchecked(e.getCause());
throw new RuntimeException(e);
}
} else if (refPattern.endsWith("/*")) {

View File

@@ -84,7 +84,7 @@ public class AndSource<T> extends AndPredicate<T>
try {
return readImpl();
} catch (OrmRuntimeException err) {
Throwables.propagateIfInstanceOf(err.getCause(), OrmException.class);
Throwables.throwIfInstanceOf(err.getCause(), OrmException.class);
throw new OrmException(err);
}
}

View File

@@ -140,7 +140,7 @@ public abstract class QueryProcessor<T> {
} catch (OrmRuntimeException e) {
throw new OrmException(e.getMessage(), e);
} catch (OrmException e) {
Throwables.propagateIfInstanceOf(e.getCause(), QueryParseException.class);
Throwables.throwIfInstanceOf(e.getCause(), QueryParseException.class);
throw e;
}
}

View File

@@ -129,7 +129,7 @@ public abstract class RequestScopePropagator {
try {
wrapped.call();
} catch (Exception e) {
Throwables.propagateIfPossible(e);
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e); // Not possible.
}
}

View File

@@ -97,7 +97,7 @@ public class AliasCommand extends BaseCommand {
try {
cmd.destroy();
} catch (Exception e) {
Throwables.propagateIfPossible(e);
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}

View File

@@ -136,7 +136,7 @@ final class DispatchCommand extends BaseCommand {
try {
cmd.destroy();
} catch (Exception e) {
Throwables.propagateIfPossible(e);
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}

View File

@@ -153,7 +153,7 @@ public final class SuExec extends BaseCommand {
try {
cmd.destroy();
} catch (Exception e) {
Throwables.propagateIfPossible(e);
Throwables.throwIfUnchecked(e);
throw new RuntimeException(e);
}
}

View File

@@ -66,9 +66,10 @@ maven_jar(
maven_jar(
name = 'guava',
id = 'com.google.guava:guava:19.0',
sha1 = '6ce200f6b23222af3d8abb6b6459e6c44f4bb0e9',
id = 'com.google.guava:guava:20.0:20160818.201422-323',
sha1 = '13af7470db1026c57aedd0144018e06fe79bba33',
license = 'Apache2.0',
repository = MAVEN_SNAPSHOT,
)
maven_jar(