Commit d80a30e
Make the TagMap Entry pathway null-tolerant (#11963)
Make the TagMap Entry pathway null-tolerant
create(Object)/create(CharSequence) may return null for a null or empty
value, and the Entry sinks -- getAndSet(Entry) / set(EntryReader) -- treat a
null Entry as a no-op, so a null/empty value flows through the Entry pathway
as "no tag" without any caller guarding. create(Object) now applies the
empty-CharSequence check by runtime type, so the null/empty => absent
convention holds regardless of the static type at the call site.
The strict (key,value) setters keep their contract -- their values are now
@nonnull -- so null tolerance is scoped to the Entry pathway. The annotations
make the split self-describing.
Fixes a latent NPE by construction: RemoteHostnameAdder sets
create(TRACER_HOST, hostname) guarding only null, not empty, so an empty
hostname previously NPE'd on set(null). Caller-side guard cleanup (incl. the
redundant #11958 guard) is left to a follow-up.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mark tag keys @nonnull on the TagMap write/create surface
A tag has no valid null key, so put/set/getAndSet/create now take @nonnull
tag. This completes the null contract alongside the value/Entry side: keys
are strict (null = a bug), values/Entries on the Entry pathway are tolerant
(null = no tag). Scoped to the write/create surface; read/lookup keys
(getString, remove, getXxxOrDefault) are left for a possible follow-up.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Brace single-statement null-check ifs per style convention
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>1 parent 9b16f91 commit d80a30e
2 files changed
Lines changed: 118 additions & 31 deletions
File tree
- internal-api/src
- main/java/datadog/trace/api
- test/java/datadog/trace/api
Lines changed: 52 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
| 20 | + | |
19 | 21 | | |
20 | 22 | | |
21 | 23 | | |
| |||
147 | 149 | | |
148 | 150 | | |
149 | 151 | | |
150 | | - | |
| 152 | + | |
151 | 153 | | |
152 | 154 | | |
153 | | - | |
| 155 | + | |
154 | 156 | | |
155 | 157 | | |
156 | 158 | | |
157 | 159 | | |
158 | 160 | | |
159 | 161 | | |
160 | | - | |
| 162 | + | |
161 | 163 | | |
162 | | - | |
| 164 | + | |
163 | 165 | | |
164 | | - | |
| 166 | + | |
165 | 167 | | |
166 | | - | |
| 168 | + | |
167 | 169 | | |
168 | | - | |
| 170 | + | |
169 | 171 | | |
170 | | - | |
| 172 | + | |
171 | 173 | | |
172 | | - | |
| 174 | + | |
| 175 | + | |
173 | 176 | | |
174 | 177 | | |
175 | | - | |
| 178 | + | |
176 | 179 | | |
177 | | - | |
| 180 | + | |
178 | 181 | | |
179 | | - | |
| 182 | + | |
180 | 183 | | |
181 | | - | |
| 184 | + | |
182 | 185 | | |
183 | | - | |
| 186 | + | |
184 | 187 | | |
185 | | - | |
| 188 | + | |
186 | 189 | | |
187 | | - | |
| 190 | + | |
188 | 191 | | |
189 | 192 | | |
190 | | - | |
191 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
192 | 197 | | |
193 | | - | |
| 198 | + | |
194 | 199 | | |
195 | 200 | | |
196 | 201 | | |
| |||
368 | 373 | | |
369 | 374 | | |
370 | 375 | | |
371 | | - | |
372 | | - | |
373 | | - | |
374 | | - | |
375 | | - | |
376 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
377 | 390 | | |
378 | 391 | | |
379 | 392 | | |
380 | | - | |
| 393 | + | |
| 394 | + | |
381 | 395 | | |
382 | 396 | | |
383 | 397 | | |
384 | 398 | | |
385 | 399 | | |
386 | 400 | | |
387 | 401 | | |
388 | | - | |
| 402 | + | |
389 | 403 | | |
390 | 404 | | |
391 | 405 | | |
392 | | - | |
| 406 | + | |
393 | 407 | | |
394 | 408 | | |
395 | 409 | | |
396 | | - | |
| 410 | + | |
397 | 411 | | |
398 | 412 | | |
399 | 413 | | |
400 | | - | |
| 414 | + | |
401 | 415 | | |
402 | 416 | | |
403 | 417 | | |
404 | | - | |
| 418 | + | |
405 | 419 | | |
406 | 420 | | |
407 | 421 | | |
| |||
1357 | 1371 | | |
1358 | 1372 | | |
1359 | 1373 | | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
1360 | 1377 | | |
1361 | 1378 | | |
1362 | 1379 | | |
| |||
1397 | 1414 | | |
1398 | 1415 | | |
1399 | 1416 | | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
1400 | 1421 | | |
1401 | 1422 | | |
1402 | 1423 | | |
| |||
Lines changed: 66 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments