Skip to content

Commit 0627a7d

Browse files
committed
add missing @nullable annotations
1 parent a12b322 commit 0627a7d

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientHelper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
import io.opentelemetry.context.Context;
1111
import org.apache.hc.core5.http.ClassicHttpRequest;
1212
import org.apache.hc.core5.http.HttpResponse;
13+
import javax.annotation.Nullable;
1314

1415
public class ApacheHttpClientHelper {
1516

1617
public static void doMethodExit(
17-
Context context, ClassicHttpRequest request, Object result, Throwable throwable) {
18+
Context context, ClassicHttpRequest request, @Nullable Object result, @Nullable Throwable throwable) {
1819
if (throwable != null) {
1920
instrumenter().end(context, request, null, throwable);
2021
} else if (result instanceof HttpResponse) {

instrumentation/apache-httpclient/apache-httpclient-5.0/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/apachehttpclient/v5_0/ApacheHttpClientInstrumentation.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static AdviceScope start(ClassicHttpRequest request) {
149149
return new AdviceScope(request, parentContext, context, context.makeCurrent());
150150
}
151151

152-
public void end(Object result, Throwable throwable) {
152+
public void end(@Nullable Object result, @Nullable Throwable throwable) {
153153
scope.close();
154154
ApacheHttpClientHelper.doMethodExit(context, request, result, throwable);
155155
}
@@ -172,7 +172,7 @@ public static AdviceScope methodEnter(@Advice.Argument(0) ClassicHttpRequest req
172172
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
173173
public static void methodExit(
174174
@Advice.Return Object result,
175-
@Advice.Thrown Throwable throwable,
175+
@Advice.Thrown @Nullable Throwable throwable,
176176
@Advice.Enter @Nullable AdviceScope scope) {
177177

178178
if (scope != null) {
@@ -206,8 +206,8 @@ public static Object[] methodEnter(
206206
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
207207
public static void methodExit(
208208
@Advice.Argument(0) ClassicHttpRequest request,
209-
@Advice.Return Object result,
210-
@Advice.Thrown Throwable throwable,
209+
@Advice.Return @Nullable Object result,
210+
@Advice.Thrown @Nullable Throwable throwable,
211211
@Advice.Enter Object[] enterResult) {
212212

213213
AdviceScope scope = (AdviceScope) enterResult[0];
@@ -242,8 +242,8 @@ public static Object[] methodEnter(
242242
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
243243
public static void methodExit(
244244
@Advice.Argument(0) ClassicHttpRequest request,
245-
@Advice.Return Object result,
246-
@Advice.Thrown Throwable throwable,
245+
@Advice.Return @Nullable Object result,
246+
@Advice.Thrown @Nullable Throwable throwable,
247247
@Advice.Enter Object[] enterResult) {
248248

249249
AdviceScope scope = (AdviceScope) enterResult[0];
@@ -267,7 +267,7 @@ public static AdviceScope methodEnter(
267267
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
268268
public static void methodExit(
269269
@Advice.Return Object result,
270-
@Advice.Thrown Throwable throwable,
270+
@Advice.Thrown @Nullable Throwable throwable,
271271
@Advice.Enter @Nullable AdviceScope scope) {
272272

273273
if (scope != null) {
@@ -302,8 +302,8 @@ public static Object[] methodEnter(
302302

303303
@Advice.OnMethodExit(onThrowable = Throwable.class, suppress = Throwable.class)
304304
public static void methodExit(
305-
@Advice.Return Object result,
306-
@Advice.Thrown Throwable throwable,
305+
@Advice.Return @Nullable Object result,
306+
@Advice.Thrown @Nullable Throwable throwable,
307307
@Advice.Enter Object[] enterResult) {
308308

309309
AdviceScope scope = (AdviceScope) enterResult[0];

0 commit comments

Comments
 (0)