Repository navigation
Commit 29b29d1
Fix NPE in DatabaseClientDecorator when JDBC connection has no db type (#12371)
Fix NPE in DatabaseClientDecorator when JDBC connection has no db type
processDatabaseType/dbService dereferenced the NamingEntry returned by
CACHE.computeIfAbsent(dbType, NamingEntry::new) without checking for
null. FixedSizeCache.computeIfAbsent returns null for a null key
without invoking the producer, so a null dbType() (e.g. an
undetermined DBInfo.getType()) led to a NullPointerException in
tracing instrumentation instead of a graceful no-op.
Guard on dbType == null directly instead of inferring it from the
cache's return value, and add a test exercising both methods with a
null dbType.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Merge branch 'master' into dougqh/fix-database-client-decorator-npe
Merge branch 'master' into dougqh/fix-database-client-decorator-npe
Merge branch 'master' into dougqh/fix-database-client-decorator-npe
Co-authored-by: devflow.devflow-routing-intake <devflow.devflow-routing-intake@kubernetes.us1.ddbuild.io>1 parent 093c8ae commit 29b29d1
2 files changed
Lines changed: 79 additions & 3 deletions
File tree
- dd-java-agent/agent-bootstrap/src
- main/java/datadog/trace/bootstrap/instrumentation/decorator
- test/java/datadog/trace/bootstrap/instrumentation/decorator
Lines changed: 9 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
100 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
| |||
144 | 146 | | |
145 | 147 | | |
146 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
147 | 153 | | |
148 | 154 | | |
149 | 155 | | |
150 | 156 | | |
151 | | - | |
| 157 | + | |
152 | 158 | | |
153 | 159 | | |
154 | 160 | | |
| |||
Lines changed: 70 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 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
0 commit comments