Skip to content

Commit 486fc42

Browse files
committed
invert size check method
1 parent ee63d11 commit 486fc42

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sentry/src/main/java/io/sentry/util/EventSizeLimitingUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private EventSizeLimitingUtils() {}
4343
return event;
4444
}
4545

46-
if (!isTooLarge(event, options)) {
46+
if (isSizeOk(event, options)) {
4747
return event;
4848
}
4949

@@ -61,7 +61,7 @@ private EventSizeLimitingUtils() {}
6161
if (callback != null) {
6262
try {
6363
reducedEvent = callback.execute(reducedEvent, hint);
64-
if (!isTooLarge(reducedEvent, options)) {
64+
if (isSizeOk(reducedEvent, options)) {
6565
return reducedEvent;
6666
}
6767
} catch (Exception e) {
@@ -76,12 +76,12 @@ private EventSizeLimitingUtils() {}
7676
}
7777

7878
reducedEvent = removeAllBreadcrumbs(reducedEvent, options);
79-
if (!isTooLarge(reducedEvent, options)) {
79+
if (isSizeOk(reducedEvent, options)) {
8080
return reducedEvent;
8181
}
8282

8383
reducedEvent = truncateStackFrames(reducedEvent, options);
84-
if (isTooLarge(reducedEvent, options)) {
84+
if (!isSizeOk(reducedEvent, options)) {
8585
options
8686
.getLogger()
8787
.log(
@@ -93,11 +93,11 @@ private EventSizeLimitingUtils() {}
9393
return reducedEvent;
9494
}
9595

96-
private static boolean isTooLarge(
96+
private static boolean isSizeOk(
9797
final @NotNull SentryEvent event, final @NotNull SentryOptions options) {
9898
final long size =
9999
JsonSerializationUtils.byteSizeOf(options.getSerializer(), options.getLogger(), event);
100-
return size > MAX_EVENT_SIZE_BYTES;
100+
return size <= MAX_EVENT_SIZE_BYTES;
101101
}
102102

103103
private static @NotNull SentryEvent removeAllBreadcrumbs(

0 commit comments

Comments
 (0)