Commit 8ec4c61
committed
fix: Handle empty 'exclude' field in appmap.yml
This commit resolves a NullPointerException that occurred when the
`exclude` field within a package definition in `appmap.yml` was
present but empty (e.g., `exclude:`). The Jackson YAML parser would
deserialize this as `null`, leading to a crash when its length was
accessed.
The fix involves two parts:
1. Modifying `AppMapConfig.java` to add a null check in the stream
reduction logic for `p.exclude`, treating a null array as having a
length of zero.
2. Initializing the `exclude` field as an empty array in the
`AppMapPackage` constructor using `@JsonCreator`, ensuring it's
never null during deserialization.
A new regression test case, `loadEmptyExcludeField`, has been added to
`AppMapConfigTest.java` to verify that an empty `exclude` field is now
handled correctly and does not cause a crash. The test ensures that
the `exclude` array is non-null and has a length of zero, confirming
the intended behavior.1 parent 0f86c84 commit 8ec4c61
File tree
3 files changed
+26
-2
lines changed- agent/src
- main/java/com/appland/appmap/config
- test/java/com/appland/appmap/config
3 files changed
+26
-2
lines changedLines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
149 | 149 | | |
150 | 150 | | |
151 | 151 | | |
| |||
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
24 | 35 | | |
25 | 36 | | |
26 | 37 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
122 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
123 | 136 | | |
0 commit comments