/** Returns zero if truncated, malformed, or too big after logging */ static long tryParseParentId(CharSequence b3, int pos, int endIndex) { if (endIndex < pos + 16) { Platform.get().log("Invalid input: truncated", null); return 0L; } long parentId = tryParse16HexCharacters(b3, pos, endIndex); if (parentId == 0L) { Platform.get() .log("Invalid input: expected a 16 lower hex parent ID at offset {0}", pos, null); return 0L; } pos += 16; if (endIndex != pos) { Platform.get().log("Invalid input: parent ID is too long", null); return 0L; } return parentId; }
traceIdHigh = tryParse16HexCharacters(b3, pos, endIndex); pos += 16; // upper 64 bits of the trace ID traceId = tryParse16HexCharacters(b3, pos, endIndex); } else { traceIdHigh = 0L; traceId = tryParse16HexCharacters(b3, pos, endIndex); long spanId = tryParse16HexCharacters(b3, pos, endIndex); if (spanId == 0L) { Platform.get().log("Invalid input: expected a 16 lower hex span ID at offset {0}", pos, null);
/** Returns zero if truncated, malformed, or too big after logging */ static long tryParseParentId(CharSequence b3, int pos, int endIndex) { if (endIndex < pos + 16) { Platform.get().log("Invalid input: truncated", null); return 0L; } long parentId = tryParse16HexCharacters(b3, pos, endIndex); if (parentId == 0L) { Platform.get() .log("Invalid input: expected a 16 lower hex parent ID at offset {0}", pos, null); return 0L; } pos += 16; if (endIndex != pos) { Platform.get().log("Invalid input: parent ID is too long", null); return 0L; } return parentId; }
traceIdHigh = tryParse16HexCharacters(b3, pos, endIndex); pos += 16; // upper 64 bits of the trace ID traceId = tryParse16HexCharacters(b3, pos, endIndex); } else { traceIdHigh = 0L; traceId = tryParse16HexCharacters(b3, pos, endIndex); long spanId = tryParse16HexCharacters(b3, pos, endIndex); if (spanId == 0L) { Platform.get().log("Invalid input: expected a 16 lower hex span ID at offset {0}", pos, null);