Skip to content

Commit 10243cf

Browse files
committed
Merge branch 'feat/ignore404-filter' into feat/ignore404-default
2 parents 5b57ecb + 4a173f2 commit 10243cf

1 file changed

Lines changed: 4 additions & 12 deletions

File tree

‎sentry/src/main/java/io/sentry/SentryClient.java‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,22 +1134,14 @@ private void recordLostTransactionAndSpans(final @NotNull SentryTransaction tran
11341134

11351135
final @Nullable Object httpStatusCodeValue =
11361136
trace.getData().get(SpanDataConvention.HTTP_STATUS_CODE_KEY);
1137-
final int httpStatusCode;
1138-
if (httpStatusCodeValue instanceof Integer) {
1139-
httpStatusCode = (Integer) httpStatusCodeValue;
1140-
} else if (httpStatusCodeValue instanceof Long) {
1141-
final long longHttpStatusCode = (Long) httpStatusCodeValue;
1142-
if (longHttpStatusCode < 100 || longHttpStatusCode > 599) {
1143-
return null;
1144-
}
1145-
httpStatusCode = (int) longHttpStatusCode;
1146-
} else {
1137+
if (!(httpStatusCodeValue instanceof Integer || httpStatusCodeValue instanceof Long)) {
11471138
return null;
11481139
}
1149-
1150-
if (httpStatusCode < 100 || httpStatusCode > 599) {
1140+
final long longHttpStatusCode = ((Number) httpStatusCodeValue).longValue();
1141+
if (longHttpStatusCode < 100 || longHttpStatusCode > 599) {
11511142
return null;
11521143
}
1144+
final int httpStatusCode = (int) longHttpStatusCode;
11531145
for (final @Nullable HttpStatusCodeRange ignoredHttpStatusCode : ignoredHttpStatusCodes) {
11541146
if (ignoredHttpStatusCode != null && ignoredHttpStatusCode.isInRange(httpStatusCode)) {
11551147
return httpStatusCode;

0 commit comments

Comments
 (0)