Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static Class<? extends Annotation> forNameOrNull(
ClassLoader classLoader, String className) {
try {
return Class.forName(className, true, classLoader).asSubclass(Annotation.class);
} catch (ClassNotFoundException | ClassCastException exception) {
} catch (ClassNotFoundException | ClassCastException ignored) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public static String processQuery(String query, TextMapPropagator propagator, bo
stringBuilder.append(", ");
}
}
} catch (UnsupportedEncodingException exception) {
} catch (UnsupportedEncodingException ignored) {
// this exception should never happen as UTF-8 encoding is always available
}
stringBuilder.append("*/");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class InternalInstrumenterCustomizerUtil {
// this class
Class.forName(
"io.opentelemetry.instrumentation.api.incubator.instrumenter.internal.InstrumenterCustomizerUtil");
} catch (ClassNotFoundException exception) {
} catch (ClassNotFoundException ignored) {
// incubator api not available, ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static Object newFrameworkModel() {
return Class.forName("org.apache.dubbo.rpc.model.FrameworkModel")
.getDeclaredConstructor()
.newInstance();
} catch (ReflectiveOperationException exception) {
} catch (ReflectiveOperationException ignored) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public void sendRequestWithCallback(
HttpClientResult requestResult) {
try {
executeRequestWithCallback(request, uri, requestResult);
} catch (Throwable throwable) {
requestResult.complete(throwable);
} catch (Throwable t) {
requestResult.complete(t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ public void sendRequestWithCallback(
HttpClientResult httpClientResult) {
try {
executeRequestWithCallback(request, uri, httpClientResult);
} catch (Throwable throwable) {
httpClientResult.complete(throwable);
} catch (Throwable t) {
httpClientResult.complete(t);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exc

try {
return unwrap().serve(ctx, req);
} catch (Throwable throwable) {
} catch (Throwable t) {
Span span = Span.fromContext(otelContext);
span.setStatus(StatusCode.ERROR);
span.recordException(ErrorCauseExtractor.getDefault().extract(throwable));
span.recordException(ErrorCauseExtractor.getDefault().extract(t));

throw throwable;
throw t;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private static Class<?> getAbortingSubscriberClass() {
// AbortingSubscriber is package private
try {
return Class.forName("com.linecorp.armeria.common.stream.AbortingSubscriber");
} catch (ClassNotFoundException exception) {
} catch (ClassNotFoundException ignored) {
return null;
}
}
Expand All @@ -30,7 +30,7 @@ private static Class<?> getNoopSubscriberClass() {
// NoopSubscriber is package private
try {
return Class.forName("com.linecorp.armeria.common.stream.NoopSubscriber");
} catch (ClassNotFoundException exception) {
} catch (ClassNotFoundException ignored) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ private static InetSocketAddress getAddress(
if (address instanceof InetSocketAddress) {
return (InetSocketAddress) address;
}
} catch (Throwable throwable) {
throw new IllegalStateException("Failed to get address", throwable);
} catch (Throwable t) {
throw new IllegalStateException("Failed to get address", t);
}
}
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ private static void setTimeout(
Method method =
builder.getClass().getMethod(methodName, testLatestDeps ? Duration.class : int.class);
method.invoke(builder, testLatestDeps ? Duration.ofMillis(timeout) : timeout);
} catch (Exception exception) {
throw new IllegalStateException("Failed to set timeout " + methodName, exception);
} catch (Exception e) {
throw new IllegalStateException("Failed to set timeout " + methodName, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private static String getFunctionArn(Context awsContext) {
}
try {
return (String) GET_FUNCTION_ARN.invoke(awsContext);
} catch (Throwable throwable) {
} catch (Throwable ignored) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private static boolean canGetResponseMetadata() {
Class<?> clazz = Class.forName("com.amazonaws.AmazonWebServiceResult");
clazz.getMethod("getSdkResponseMetadata");
return true;
} catch (ClassNotFoundException | NoSuchMethodException exception) {
} catch (ClassNotFoundException | NoSuchMethodException ignored) {
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1154,8 +1154,8 @@ private static Object invokeProxyMethod(Method method, Object target, Object[] a
throws Throwable {
try {
return method.invoke(target, args);
} catch (InvocationTargetException exception) {
throw exception.getCause();
} catch (InvocationTargetException e) {
throw e.getCause();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ public static SqsAsyncClient wrap(SqsAsyncClient sqsClient) {
});

return resultFuture;
} catch (InvocationTargetException exception) {
throw exception.getCause();
} catch (InvocationTargetException e) {
throw e.getCause();
}
} else {
return invokeProxyMethod(method, sqsClient, args);
Expand All @@ -355,8 +355,8 @@ private static Object invokeProxyMethod(Method method, Object target, Object[] a
throws Throwable {
try {
return method.invoke(target, args);
} catch (InvocationTargetException exception) {
throw exception.getCause();
} catch (InvocationTargetException e) {
throw e.getCause();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,10 @@ public SdkRequest modifyRequest(
executionAttributes.putAttribute(AWS_SDK_REQUEST_ATTRIBUTE, awsSdkRequest);
fieldMapper.mapToAttributes(request, awsSdkRequest, span);
}
} catch (Throwable throwable) {
requestFinisher.finish(otelContext, executionAttributes, null, throwable);
} catch (Throwable t) {
requestFinisher.finish(otelContext, executionAttributes, null, t);
clearAttributes(executionAttributes);
throw throwable;
throw t;
}

SdkRequest modifiedRequest =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ private static ResultSet execute(CqlSession session, String query) {
ResultSet resultSet;
try (Scope ignored = context.makeCurrent()) {
resultSet = session.execute(query);
} catch (Throwable exception) {
instrumenter().end(context, request, getExecutionInfo(exception), exception);
throw exception;
} catch (Throwable t) {
instrumenter().end(context, request, getExecutionInfo(t), t);
throw t;
}
instrumenter().end(context, request, resultSet.getExecutionInfo(), null);
return resultSet;
Expand All @@ -88,9 +88,9 @@ private static ResultSet execute(CqlSession session, Statement<?> statement) {
ResultSet resultSet;
try (Scope ignored = context.makeCurrent()) {
resultSet = session.execute(statement);
} catch (Throwable exception) {
instrumenter().end(context, request, getExecutionInfo(exception), exception);
throw exception;
} catch (Throwable t) {
instrumenter().end(context, request, getExecutionInfo(t), t);
throw t;
}
instrumenter().end(context, request, resultSet.getExecutionInfo(), null);
return resultSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,9 @@ private ResultSet execute(CqlSession session, String query) {
ResultSet resultSet;
try (Scope ignored = context.makeCurrent()) {
resultSet = session.execute(query);
} catch (Throwable exception) {
instrumenter.end(context, request, getExecutionInfo(exception), exception);
throw exception;
} catch (Throwable t) {
instrumenter.end(context, request, getExecutionInfo(t), t);
throw t;
}
instrumenter.end(context, request, resultSet.getExecutionInfo(), null);
return resultSet;
Expand All @@ -108,9 +108,9 @@ private ResultSet execute(CqlSession session, Statement<?> statement) {
ResultSet resultSet;
try (Scope ignored = context.makeCurrent()) {
resultSet = session.execute(statement);
} catch (Throwable exception) {
instrumenter.end(context, request, getExecutionInfo(exception), exception);
throw exception;
} catch (Throwable t) {
instrumenter.end(context, request, getExecutionInfo(t), t);
throw t;
}
instrumenter.end(context, request, resultSet.getExecutionInfo(), null);
return resultSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ private static String getQueryText(MethodHandle handle, Object query) {
}
try {
return handle.invoke(query).toString();
} catch (Throwable throwable) {
} catch (Throwable ignored) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ private static Field getInstrumenterSupplierField(Class<?> clazz) {
private static Field getProxyField(Class<?> clazz, String fieldName) {
try {
return clazz.getDeclaredField(fieldName);
} catch (NoSuchFieldException exception) {
throw new IllegalStateException("Could not find proxy field", exception);
} catch (NoSuchFieldException e) {
throw new IllegalStateException("Could not find proxy field", e);
}
}

Expand Down Expand Up @@ -161,8 +161,8 @@ private static Function<RestClient, RestClient> getProxyFactory(Class<?> clazz)
}
try {
return (RestClient) constructor.newInstance(arguments);
} catch (Exception exception) {
throw new IllegalStateException("Failed to construct proxy instance", exception);
} catch (Exception e) {
throw new IllegalStateException("Failed to construct proxy instance", e);
}
};
}
Expand All @@ -186,8 +186,8 @@ static RestClient wrap(
instrumenterSupplierField.set(
wrapped, (Supplier<Instrumenter<ElasticsearchRestRequest, Response>>) () -> instrumenter);
return wrapped;
} catch (Exception exception) {
throw new IllegalStateException("Failed to construct proxy instance", exception);
} catch (Exception e) {
throw new IllegalStateException("Failed to construct proxy instance", e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ void setFailure(Throwable failure) {
RESPONSE get() {
try {
assertThat(latch.await(1, MINUTES)).isTrue();
} catch (InterruptedException exception) {
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new IllegalStateException("Interrupted while waiting for response", exception);
throw new IllegalStateException("Interrupted while waiting for response", e);
}
if (response != null) {
return response;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void multipleForkJoin() throws Exception {
try {
// since jdk 25-ea+24
tmp = (StructuredTaskScope) StructuredTaskScope.class.getMethod("open").invoke(null);
} catch (NoSuchMethodException exception) {
} catch (NoSuchMethodException ignored) {
tmp =
Class.forName("java.util.concurrent.StructuredTaskScope$ShutdownOnFailure")
.asSubclass(StructuredTaskScope.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ public void run() {
isPropagationDisabled.set(ExecutorAdviceHelper.isPropagationDisabled());
return null;
});
} catch (Exception exception) {
error = exception;
} catch (Exception e) {
error = e;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ public Collection<Class> classes() {
private static Class<?> load(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException exception) {
throw new IllegalStateException(exception);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public DataFetcher<?> instrumentDataFetcher(
Object fieldValue;
try (Scope ignored = childContext.makeCurrent()) {
fieldValue = dataFetcher.get(environment);
} catch (Throwable throwable) {
dataFetcherInstrumenter.end(childContext, environment, null, throwable);
throw throwable;
} catch (Throwable t) {
dataFetcherInstrumenter.end(childContext, environment, null, t);
throw t;
}

if (fieldValue instanceof CompletionStage) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ private <REQUEST, RESPONSE> void end(
try {
Object response = Uninterruptibles.getUninterruptibly(future);
instrumenter.end(context, request, tryToGetResponse(responseType, response), null);
} catch (Throwable exception) {
instrumenter.end(context, request, null, exception);
} catch (Throwable t) {
instrumenter.end(context, request, null, t);
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static HibernateOperationScope startMethod(@Advice.This CommonQueryContra
if (query instanceof SqmQuery) {
try {
queryString = ((SqmQuery) query).getSqmStatement().toHqlString();
} catch (RuntimeException exception) {
} catch (RuntimeException ignored) {
// ignore
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ private static boolean hasInterfaceClassField() {
Class<?> clazz = Class.forName("java.lang.invoke.AbstractValidatingLambdaMetafactory");
clazz.getDeclaredField("interfaceClass");
return true;
} catch (NoSuchFieldException exception) {
} catch (NoSuchFieldException ignored) {
return false;
} catch (ClassNotFoundException exception) {
throw new IllegalStateException(exception);
} catch (ClassNotFoundException e) {
throw new IllegalStateException(e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static byte[] transform(byte[] classBytes, String slashClassName, Class<?
if (result != null) {
classBytes = result;
}
} catch (Throwable throwable) {
} catch (Throwable ignored) {
// sun.instrument.TransformerManager catches Throwable from ClassFileTransformer and ignores
// it, we do the same.
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ public int sendRequest(
String body = "POST".equals(method) || "PUT".equals(method) ? "" : null;
try {
return builder.method(method, ClientResponse.class, body).getStatus();
} catch (ClientHandlerException exception) {
Throwable cause = exception.getCause();
} catch (ClientHandlerException e) {
Throwable cause = e.getCause();
if (cause instanceof Exception) {
throw (Exception) cause;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,11 @@ public int sendRequest(
response.readEntity(String.class);
response.close();
return response.getStatus();
} catch (ProcessingException exception) {
if (exception.getCause() instanceof Exception) {
throw (Exception) exception.getCause();
} catch (ProcessingException e) {
if (e.getCause() instanceof Exception) {
throw (Exception) e.getCause();
}
throw exception;
throw e;
}
}

Expand Down
Loading
Loading