Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b1ced85
Add sentry replay envelope and event
romtsn Feb 1, 2024
f8419d1
Merge branch 'rz/feat/session-replay-sources' into rz/feat/session-re…
romtsn Feb 13, 2024
a63cac1
WIP
romtsn Feb 15, 2024
fa72057
Add replay envelopes
romtsn Feb 19, 2024
6cfb511
Remove jsonValue
romtsn Feb 19, 2024
0d031d7
Remove
romtsn Feb 19, 2024
07e6b26
Fix json
romtsn Feb 19, 2024
18af924
Finalize replay envelopes
romtsn Feb 20, 2024
64cedfa
Introduce MapObjectReader
romtsn Feb 20, 2024
b8cb924
Add missing test
romtsn Feb 20, 2024
28d341f
Merge branch 'rz/feat/session-replay-envelopes' into rz/feat/session-…
romtsn Feb 20, 2024
1e76fc7
Add test for MapObjectReader
romtsn Feb 22, 2024
13c1971
Add MapObjectWriter change
romtsn Feb 22, 2024
a14e090
Merge branch 'rz/feat/session-replay-envelopes' into rz/feat/session-…
romtsn Feb 22, 2024
86baf7f
Add finals
romtsn Feb 22, 2024
f1ca9f6
Fix test
romtsn Feb 22, 2024
fbbe0d9
Fix test
romtsn Feb 22, 2024
688233f
Merge branch 'rz/feat/session-replay-envelopes' into rz/feat/session-…
romtsn Feb 22, 2024
fd63960
Address review
romtsn Feb 28, 2024
93785cc
Add finals and annotations
romtsn Feb 28, 2024
4db19e0
Merge pull request #3215 from getsentry/rz/feat/session-replay-map-ob…
romtsn Feb 28, 2024
62477b4
Remove public captureReplay method
romtsn Mar 1, 2024
af42fb3
Fix test
romtsn Mar 1, 2024
cd09739
Merge branch 'rz/feat/session-replay-sources' into rz/feat/session-re…
romtsn Mar 1, 2024
4e54c77
api dump
romtsn Mar 1, 2024
fb14ecb
Merge branch 'rz/feat/session-replay' into rz/feat/session-replay-env…
romtsn Mar 4, 2024
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
Prev Previous commit
Next Next commit
Add finals
  • Loading branch information
romtsn committed Feb 22, 2024
commit 86baf7fc968a8ccc7dc7e8bdce22bd37e60bf8a6
3 changes: 2 additions & 1 deletion sentry/src/main/java/io/sentry/ObjectReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
import org.jetbrains.annotations.Nullable;

public interface ObjectReader extends Closeable {
static @Nullable Date dateOrNull(@Nullable String dateString, final @NotNull ILogger logger) {
static @Nullable Date dateOrNull(
final @Nullable String dateString, final @NotNull ILogger logger) {
if (dateString == null) {
return null;
}
Expand Down
53 changes: 27 additions & 26 deletions sentry/src/main/java/io/sentry/util/MapObjectReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public MapObjectReader(final Map<String, Object> root) {
}

@Override
public void nextUnknown(final @NotNull ILogger logger, Map<String, Object> unknown, String name) {
public void nextUnknown(
final @NotNull ILogger logger, final Map<String, Object> unknown, final String name) {
try {
unknown.put(name, nextObjectOrNull());
} catch (Exception exception) {
Expand Down Expand Up @@ -63,14 +64,14 @@ public <T> T nextOrNull(
@Nullable
@Override
public Date nextDateOrNull(final @NotNull ILogger logger) throws IOException {
String dateString = nextStringOrNull();
final String dateString = nextStringOrNull();
return ObjectReader.dateOrNull(dateString, logger);
}

@Nullable
@Override
public TimeZone nextTimeZoneOrNull(final @NotNull ILogger logger) throws IOException {
String timeZoneId = nextStringOrNull();
final String timeZoneId = nextStringOrNull();
return timeZoneId != null ? TimeZone.getTimeZone(timeZoneId) : null;
}

Expand All @@ -87,7 +88,7 @@ public JsonToken peek() throws IOException {
return JsonToken.END_DOCUMENT;
}

Map.Entry<String, Object> currentEntry = stack.peekLast();
final Map.Entry<String, Object> currentEntry = stack.peekLast();
if (currentEntry == null) {
return JsonToken.END_DOCUMENT;
}
Expand All @@ -96,7 +97,7 @@ public JsonToken peek() throws IOException {
return JsonToken.NAME;
}

Object value = currentEntry.getValue();
final Object value = currentEntry.getValue();

if (value instanceof Map) {
return JsonToken.BEGIN_OBJECT;
Expand All @@ -118,7 +119,7 @@ public JsonToken peek() throws IOException {
@NotNull
@Override
public String nextName() throws IOException {
Map.Entry<String, Object> currentEntry = stack.peekLast();
final Map.Entry<String, Object> currentEntry = stack.peekLast();
if (currentEntry != null && currentEntry.getKey() != null) {
return currentEntry.getKey();
}
Expand All @@ -127,11 +128,11 @@ public String nextName() throws IOException {

@Override
public void beginObject() throws IOException {
Map.Entry<String, Object> currentEntry = stack.removeLast();
final Map.Entry<String, Object> currentEntry = stack.removeLast();
if (currentEntry == null) {
throw new IOException("No more entries");
}
Object value = currentEntry.getValue();
final Object value = currentEntry.getValue();
if (value instanceof Map) {
// insert a dummy entry to indicate end of an object
stack.addLast(new AbstractMap.SimpleEntry<>(null, JsonToken.END_OBJECT));
Expand All @@ -153,17 +154,17 @@ public void endObject() throws IOException {

@Override
public void beginArray() throws IOException {
Map.Entry<String, Object> currentEntry = stack.removeLast();
final Map.Entry<String, Object> currentEntry = stack.removeLast();
if (currentEntry == null) {
throw new IOException("No more entries");
}
Object value = currentEntry.getValue();
final Object value = currentEntry.getValue();
if (value instanceof List) {
// insert a dummy entry to indicate end of an object
stack.addLast(new AbstractMap.SimpleEntry<>(null, JsonToken.END_ARRAY));
// extract map entries onto the stack
for (int i = ((List<?>) value).size() - 1; i >= 0; i--) {
Object entry = ((List<?>) value).get(i);
final Object entry = ((List<?>) value).get(i);
stack.addLast(new AbstractMap.SimpleEntry<>(null, entry));
}
} else {
Expand All @@ -185,7 +186,7 @@ public boolean hasNext() throws IOException {

@Override
public int nextInt() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).intValue();
} else {
Expand All @@ -196,7 +197,7 @@ public int nextInt() throws IOException {
@Nullable
@Override
public Integer nextIntegerOrNull() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).intValue();
}
Expand All @@ -205,7 +206,7 @@ public Integer nextIntegerOrNull() throws IOException {

@Override
public long nextLong() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).longValue();
} else {
Expand All @@ -216,7 +217,7 @@ public long nextLong() throws IOException {
@Nullable
@Override
public Long nextLongOrNull() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).longValue();
}
Expand All @@ -225,7 +226,7 @@ public Long nextLongOrNull() throws IOException {

@Override
public String nextString() throws IOException {
String value = nextValueOrNull();
final String value = nextValueOrNull();
if (value != null) {
return value;
} else {
Expand All @@ -241,7 +242,7 @@ public String nextStringOrNull() throws IOException {

@Override
public boolean nextBoolean() throws IOException {
Boolean value = nextValueOrNull();
final Boolean value = nextValueOrNull();
if (value != null) {
return value;
} else {
Expand All @@ -257,7 +258,7 @@ public Boolean nextBooleanOrNull() throws IOException {

@Override
public double nextDouble() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).doubleValue();
} else {
Expand All @@ -268,7 +269,7 @@ public double nextDouble() throws IOException {
@Nullable
@Override
public Double nextDoubleOrNull() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
Expand All @@ -278,7 +279,7 @@ public Double nextDoubleOrNull() throws IOException {
@Nullable
@Override
public Float nextFloatOrNull() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).floatValue();
}
Expand All @@ -287,7 +288,7 @@ public Float nextFloatOrNull() throws IOException {

@Override
public float nextFloat() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value instanceof Number) {
return ((Number) value).floatValue();
} else {
Expand All @@ -297,14 +298,14 @@ public float nextFloat() throws IOException {

@Override
public void nextNull() throws IOException {
Object value = nextValueOrNull();
final Object value = nextValueOrNull();
if (value != null) {
throw new IOException("Expected null but was " + peek());
}
}

@Override
public void setLenient(boolean lenient) {}
public void setLenient(final boolean lenient) {}

@Override
public void skipValue() throws IOException {}
Expand All @@ -324,17 +325,17 @@ private <T> T nextValueOrNull() throws IOException {
private <T> T nextValueOrNull(
final @Nullable ILogger logger, final @Nullable JsonDeserializer<T> deserializer)
throws Exception {
Map.Entry<String, Object> currentEntry = stack.peekLast();
final Map.Entry<String, Object> currentEntry = stack.peekLast();
if (currentEntry == null) {
return null;
}
T value = (T) currentEntry.getValue();
final T value = (T) currentEntry.getValue();
if (deserializer != null && logger != null) {
return deserializer.deserialize(this, logger);
} else if (value instanceof List) {
List<Object> list = new ArrayList<>((List<Object>) value);
if (!list.isEmpty()) {
T next = (T) list.remove(0);
final T next = (T) list.remove(0);
if (next instanceof Map) {
stack.addLast(new AbstractMap.SimpleEntry<>(null, next));
}
Expand Down