Skip to content

Commit

Permalink
TraceEvent: Handle larger prefixes in the json
Browse files Browse the repository at this point in the history
Signed-off-by: Matthew Khouzam <[email protected]>
  • Loading branch information
MatthewKhouzam committed Dec 4, 2024
1 parent 7d62fa2 commit a87455a
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -228,13 +228,14 @@ protected static void goToCorrectStart(RandomAccessFile rafile) throws IOExcepti
skipList.add((int) ' ');
skipList.add((int) '\b');
skipList.add((int) '\f');
while (val != -1 && val != ':' && sb.length() < 14) {
int maxLen = 1024;
while (val != -1 && val != ':' && sb.length() < maxLen && !sb.toString().endsWith(traceEventsKey)) {
if (!skipList.contains(val)) {
sb.append((char) val);
}
val = rafile.read();
}
if (!(sb.toString().startsWith('{' + traceEventsKey) && rafile.length() > 14)) {
if (!(sb.toString().endsWith(traceEventsKey) && rafile.length() > maxLen)) {
// Trace does not start with {"TraceEvents", maybe it's the events
// directly, go back to start of trace
rafile.seek(0);
Expand Down

0 comments on commit a87455a

Please sign in to comment.