Skip to content

Commit a7508bc

Browse files
committed
Minor cleanup
1 parent e4a26ff commit a7508bc

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

sentry/src/main/java/io/sentry/util/network/NetworkBody.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
import org.jetbrains.annotations.Nullable;
66

77
/**
8-
* Represents the body content of a network request or response. Can be one of: JSON object, JSON
9-
* array, or string.
8+
* Represents the body content of a network request or response.
109
*
1110
* <p>See <a
1211
* href="https://github.com/getsentry/sentry-javascript/blob/develop/packages/replay-internal/src/types/request.ts">Javascript
@@ -36,6 +35,8 @@ public NetworkBody(
3635
return warnings;
3736
}
3837

38+
// Based on
39+
// https://github.com/getsentry/sentry/blob/ccb61aa9b0f33e1333830093a5ce3bd5db88ef33/static/app/utils/replays/replay.tsx#L5-L12
3940
public enum NetworkBodyWarning {
4041
JSON_TRUNCATED("JSON_TRUNCATED"),
4142
TEXT_TRUNCATED("TEXT_TRUNCATED"),

sentry/src/main/java/io/sentry/util/network/NetworkBodyParser.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ private NetworkBodyParser() {}
6060
return parse(content, contentType, isPartial, logger);
6161
} catch (UnsupportedEncodingException e) {
6262
logger.log(SentryLevel.WARNING, "Failed to decode bytes: " + e.getMessage());
63-
final List<NetworkBody.NetworkBodyWarning> warnings = new ArrayList<>();
64-
warnings.add(NetworkBody.NetworkBodyWarning.BODY_PARSE_ERROR);
65-
return new NetworkBody("[Failed to decode bytes, " + bytes.length + " bytes]", warnings);
63+
return new NetworkBody(
64+
"[Failed to decode bytes, " + bytes.length + " bytes]",
65+
Collections.singletonList(NetworkBody.NetworkBodyWarning.BODY_PARSE_ERROR));
6666
}
6767
}
6868

0 commit comments

Comments
 (0)