Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public static long parseUnsignedLong(String s) throws NumberFormatException {
if (ok < 0) {
throw new NumberFormatException("Illegal character in " + s);
}
if (first > MAX_FIRST_PART) {
if (Long.compareUnsigned(first, MAX_FIRST_PART) > 0) {
throw numberFormatOutOfLongRange(s);
}
long guard = first * 10;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void convertIdsFromToString(String stringId, long expectedId) {
"-1",
"18446744073709551616",
"18446744073709551625",
"99999999999999999999",
"184467440737095516150",
"18446744073709551a1",
"184467440737095511a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ void convert64BitIdsFromToStringRepresentation(String stringId, DD64bTraceId exp
"-1",
"18446744073709551616",
"18446744073709551625",
"99999999999999999999",
"184467440737095516150",
"18446744073709551a1",
"184467440737095511a"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,19 +260,21 @@ void extractHttpHeadersWithOutOfRangeSpanId() {
}

@TableTest({
"scenario | traceId | spanId | expectExtraction",
"negative traceId | '-1' | '1' | false ",
"negative spanId | '1' | '-1' | false ",
"zero traceId | '0' | '1' | false ",
"zero spanId | '1' | '0' | true ",
"uint64 max traceId | 'MAX' | '1' | true ",
"out-of-range traceId | 'MAX+1' | '1' | false ",
"uint64 max spanId | '1' | 'MAX' | true ",
"out-of-range spanId | '1' | 'MAX+1' | false ",
"empty traceId | '' | '1' | false ",
"empty spanId | '1' | '' | false ",
"hex traceId | '0x1a' | '1' | false ",
"hex spanId | '1' | '0x1a' | false "
"scenario | traceId | spanId | expectExtraction",
"negative traceId | '-1' | '1' | false ",
"negative spanId | '1' | '-1' | false ",
"zero traceId | '0' | '1' | false ",
"zero spanId | '1' | '0' | true ",
"uint64 max traceId | 'MAX' | '1' | true ",
"out-of-range traceId | 'MAX+1' | '1' | false ",
"wrapping traceId | '99999999999999999999' | '1' | false ",
"uint64 max spanId | '1' | 'MAX' | true ",
"out-of-range spanId | '1' | 'MAX+1' | false ",
"wrapping spanId | '1' | '99999999999999999999' | false ",
"empty traceId | '' | '1' | false ",
"empty spanId | '1' | '' | false ",
"hex traceId | '0x1a' | '1' | false ",
"hex spanId | '1' | '0x1a' | false "
})
void moreIdRangeValidation(
@ConvertWith(TraceIdConverter.class) String traceId,
Expand Down
Loading