core: change catch blocks for Android <19 (#6611)

Caught by lint warning during import
This commit is contained in:
Eric Gribkoff 2020-01-21 14:38:10 -08:00 committed by GitHub
parent 74cde7e8b4
commit 42f2e7f733
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 10 deletions

View File

@ -576,8 +576,14 @@ public abstract class AbstractManagedChannelImplBuilder
recordStartedRpcs,
recordFinishedRpcs,
recordRealTimeMetrics);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
| InvocationTargetException e) {
} catch (ClassNotFoundException e) {
// Replace these separate catch statements with multicatch when Android min-API >= 19
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (NoSuchMethodException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (IllegalAccessException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (InvocationTargetException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
}
if (statsInterceptor != null) {
@ -595,9 +601,15 @@ public abstract class AbstractManagedChannelImplBuilder
Method getClientInterceptroMethod =
censusTracingAccessor.getDeclaredMethod("getClientInterceptor");
tracingInterceptor = (ClientInterceptor) getClientInterceptroMethod.invoke(null);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
| InvocationTargetException e) {
log.log(Level.FINE, "Unable to apply census tracing", e);
} catch (ClassNotFoundException e) {
// Replace these separate catch statements with multicatch when Android min-API >= 19
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (NoSuchMethodException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (IllegalAccessException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (InvocationTargetException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
}
if (tracingInterceptor != null) {
effectiveInterceptors.add(0, tracingInterceptor);

View File

@ -253,8 +253,14 @@ public abstract class AbstractServerImplBuilder<T extends AbstractServerImplBuil
recordStartedRpcs,
recordFinishedRpcs,
recordRealTimeMetrics);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
| InvocationTargetException e) {
} catch (ClassNotFoundException e) {
// Replace these separate catch statements with multicatch when Android min-API >= 19
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (NoSuchMethodException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (IllegalAccessException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (InvocationTargetException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
}
if (censusStatsTracerFactory != null) {
@ -270,9 +276,15 @@ public abstract class AbstractServerImplBuilder<T extends AbstractServerImplBuil
censusTracingAccessor.getDeclaredMethod("getServerStreamTracerFactory");
tracingStreamTracerFactory =
(ServerStreamTracer.Factory) getServerStreamTracerFactoryMethod.invoke(null);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException
| InvocationTargetException e) {
log.log(Level.FINE, "Unable to apply census tracing", e);
} catch (ClassNotFoundException e) {
// Replace these separate catch statements with multicatch when Android min-API >= 19
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (NoSuchMethodException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (IllegalAccessException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
} catch (InvocationTargetException e) {
log.log(Level.FINE, "Unable to apply census stats", e);
}
if (tracingStreamTracerFactory != null) {
tracerFactories.add(tracingStreamTracerFactory);