Commit 9d9b6f2
fix: address scholic-chorus review findings across agent, extension, and plugins
Applies 16 fixes surfaced by a multi-scholic review of the jb/configurations
branch. Each item below was verified against current HEAD before editing.
agent:
- Main.loadEmbeddedProbe: close the probe InputStream via try-with-resources
and stop returning true from a stub that installs nothing; log an operator
warn so the probes= argument no longer silently succeeds.
- Main.appendBootJar / appendSystemJar: synchronize the
contains/appendTo/add block on the respective Set so two threads cannot
both pass the dedup check and double-append the same jar.
- Main libs deprecation: emit at log.warn (was hidden behind isDebugEnabled).
- AgentManifestLibs.scanLibTree: close the Files.walk stream via
try-with-resources (Files.walk is backed by a DirectoryStream).
- AgentManifestLibs.locateAgentPath: broaden the catch to include
IllegalArgumentException and FileSystemNotFoundException (both thrown by
Paths.get(URI) for non-file code sources), and drop the dead
Files.isDirectory/else branch that returned the same value in both arms.
- AgentManifestLibs.filterAndNormalize: when toRealPath() fails, compare np
against home.toAbsolutePath().normalize() instead of the raw home path so
the fallback is at the same normalization level as np, and emit a warn so
operators know symlink resolution was bypassed.
- RemoteClient.reconnect: publish this.disconnecting=false last so the
volatile write acts as a release fence for the prior sock/ois/oos writes.
extension:
- EmbeddedExtensionRepository.readManifestIndex: trim each id after splitting
the BTrace-Embedded-Extensions manifest value so a human-written
"ext1, ext2" no longer produces a leading-space id that isValidExtensionId
rejects.
- EmbeddedExtensionRepository.discoverBundledProbes: read the bundled probe
list from the extension's properties file (probes=Probe1,Probe2) instead
of always returning an empty list, so ExtensionDescriptorDTO actually
carries the probes the extension declares.
- MethodHandleCache: add a negative cache so a repeated lookup for a missing
method fails fast via the cached LookupRuntimeException instead of
re-entering the reflective machinery on every call.
core:
- ProbeConfiguration.setOutput: use toLowerCase(Locale.ROOT) instead of
default-locale toLowerCase() so Turkish dotted/dotless-I does not make
"JFR" / "FILE" fall through to IllegalArgumentException.
maven plugin:
- FatAgentMojo.execute: wrap the staging-directory lifetime in try-finally
so deleteDirectory runs on every exit path, not just the happy one.
gradle plugin:
- BTraceFatAgentExtension Maven/File extractFromZip: switch from
project.buildDir (deprecated in Gradle 7, removed in Gradle 9) to
project.layout.buildDirectory.dir(...).get().asFile.
housekeeping:
- Remove the accidentally-committed top-level compile.log and add it to
.gitignore so it cannot be reintroduced.
Tests: full builds of btrace-core, btrace-extension, btrace-agent,
btrace-maven-plugin, and btrace-gradle-plugin are green, including
FatAgentMojoTest, AgentManifestLibsTest, SecurityValidationTest,
MainTest, and ExtensionBridgeImplPolicyTest.
The ClassDataLoader double-define race also surfaced in the review but the
chosen fix is still under discussion (see inline PR comment on
ClassDataLoader.findClass re: registerAsParallelCapable vs. synchronized
block on getClassLoadingLock) and is deliberately not included in this
commit.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent dbd3964 commit 9d9b6f2
10 files changed
Lines changed: 140 additions & 105 deletions
File tree
- btrace-agent/src/main/java/org/openjdk/btrace/agent
- btrace-core/src/main/java/org/openjdk/btrace/core/extensions
- btrace-extension/src/main/java/org/openjdk/btrace/extension
- impl
- util
- btrace-gradle-plugin/src/main/groovy/org/openjdk/btrace/gradle
- btrace-maven-plugin/src/main/java/org/openjdk/btrace/maven
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
Lines changed: 19 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
122 | 123 | | |
123 | 124 | | |
124 | 125 | | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
| 126 | + | |
| 127 | + | |
131 | 128 | | |
132 | 129 | | |
133 | 130 | | |
| |||
168 | 165 | | |
169 | 166 | | |
170 | 167 | | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
175 | 172 | | |
176 | 173 | | |
177 | 174 | | |
| |||
231 | 228 | | |
232 | 229 | | |
233 | 230 | | |
234 | | - | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
235 | 235 | | |
236 | | - | |
237 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
238 | 241 | | |
239 | 242 | | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
240 | 246 | | |
241 | 247 | | |
242 | 248 | | |
| |||
Lines changed: 36 additions & 42 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
443 | 443 | | |
444 | 444 | | |
445 | 445 | | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
446 | 451 | | |
447 | 452 | | |
448 | | - | |
449 | | - | |
| 453 | + | |
450 | 454 | | |
451 | 455 | | |
452 | 456 | | |
453 | 457 | | |
454 | | - | |
455 | 458 | | |
456 | | - | |
457 | | - | |
458 | | - | |
459 | | - | |
460 | | - | |
461 | | - | |
462 | | - | |
463 | | - | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
468 | | - | |
469 | | - | |
470 | | - | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
476 | | - | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
477 | 469 | | |
478 | 470 | | |
479 | 471 | | |
| |||
621 | 613 | | |
622 | 614 | | |
623 | 615 | | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
630 | 620 | | |
631 | 621 | | |
632 | 622 | | |
| |||
995 | 985 | | |
996 | 986 | | |
997 | 987 | | |
998 | | - | |
999 | | - | |
1000 | | - | |
1001 | | - | |
1002 | 988 | | |
1003 | 989 | | |
1004 | 990 | | |
1005 | 991 | | |
1006 | | - | |
1007 | | - | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
1008 | 1001 | | |
1009 | 1002 | | |
1010 | 1003 | | |
| |||
1014 | 1007 | | |
1015 | 1008 | | |
1016 | 1009 | | |
1017 | | - | |
1018 | | - | |
1019 | | - | |
1020 | | - | |
1021 | 1010 | | |
1022 | 1011 | | |
1023 | 1012 | | |
1024 | 1013 | | |
1025 | | - | |
1026 | | - | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
1027 | 1021 | | |
1028 | 1022 | | |
1029 | 1023 | | |
| |||
Lines changed: 4 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
395 | 394 | | |
396 | 395 | | |
397 | 396 | | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
398 | 401 | | |
399 | 402 | | |
400 | 403 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
68 | | - | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
Lines changed: 26 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
137 | 137 | | |
138 | 138 | | |
139 | 139 | | |
140 | | - | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
141 | 148 | | |
142 | 149 | | |
143 | 150 | | |
| |||
186 | 193 | | |
187 | 194 | | |
188 | 195 | | |
189 | | - | |
190 | | - | |
| 196 | + | |
| 197 | + | |
191 | 198 | | |
192 | 199 | | |
193 | 200 | | |
| |||
214 | 221 | | |
215 | 222 | | |
216 | 223 | | |
217 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
218 | 227 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
224 | 241 | | |
225 | 242 | | |
226 | 243 | | |
| |||
Lines changed: 33 additions & 18 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
47 | 62 | | |
48 | 63 | | |
49 | 64 | | |
| |||
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
355 | 358 | | |
356 | 359 | | |
357 | 360 | | |
| |||
417 | 420 | | |
418 | 421 | | |
419 | 422 | | |
420 | | - | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
421 | 427 | | |
422 | 428 | | |
423 | 429 | | |
| |||
0 commit comments