Commit f6d1dff
Improve YAML parsing robustness and handle null Avro types (#202)
* Wrap Dynamics.newFromYaml() to handle malformed YAML
snakeyaml throws IndexOutOfBoundsException when parsing malformed YAML
via Dynamics.newFromYaml(). The call in estimateElementStatus() was
outside the existing try/catch, causing the exception to propagate up
through the JDBC layer and crash getPipelineStatus requests.
- Wrap Dynamics.newFromYaml() in estimateElementStatus() with try/catch;
return a default unready status on parse failure instead of propagating
- Same fix in getElementConfiguration() which had the identical pattern
- Add tests for both: malformed YAML returns unready status / empty map
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix: Handle SnakeYAML parsing exceptions in operator
SnakeYAML throws ScannerException, ParserException, and ConstructorException
when parsing malformed YAML in Kubernetes resource specs or annotations. Two
call sites were unprotected:
1. Operator.isReady(String yaml) and Operator.isFailed(String yaml): the
Dynamics.newFromYaml() call was outside the existing try/catch, so any
parse error would propagate up and crash the SubscriptionReconciler
(stack trace through SubscriptionReconciler.reconcile line 171 ->
Operator.isReady line 180).
2. SubscriptionReconciler.fetchAttributes(String yaml): same unprotected
Dynamics.newFromYaml() call, returns empty map on parse failure instead.
The K8sPipelineElementStatusEstimator call site was already fixed in a prior commit; this commit adds additional tests covering ScannerException,
ParserException, and ConstructorException for completeness.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix: Guard against NullPointerException in K8sPipelineElementStatusEstimator
When Dynamics.newFromYaml() parses YAML without a metadata field, the
resulting DynamicKubernetesObject has null metadata. Calling
obj.getMetadata().getName() on it caused NPE in estimateElementStatus().
Guard against null metadata by returning an unready status early,
consistent with how we handle other parse/retrieval failures.
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
* fix: handle null Avro schemas in AvroConverter to prevent NPE
Add null guard at entry to AvroConverter.rel() and explicit NULL type
handling. When a null schema or NULL-typed schema is encountered,
returns a proper SQL NULL type instead of throwing NPE.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* fix: downgrade YAML exception logs ERROR→WARN, add null-safety guards
- K8sPipelineElementStatusEstimator: downgrade YAML parse errors from
ERROR to WARN — exceptions are caught and handled correctly, ERROR
level was causing spurious automated tickets
- Operator.isReady/isFailed: guard against null metadata and null
namespace in K8s resource
- SubscriptionReconciler.fetchAttributes: guard against null metadata;
downgrade SQL validation errors to WARN level
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Clean up comments & tests
* Build fixes - forgot to commit
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent 3842f9d commit f6d1dff
10 files changed
Lines changed: 397 additions & 8 deletions
File tree
- hoptimator-avro/src
- main/java/com/linkedin/hoptimator/avro
- test/java/com/linkedin/hoptimator/avro
- hoptimator-k8s/src
- main/java/com/linkedin/hoptimator/k8s
- status
- test/java/com/linkedin/hoptimator/k8s
- status
- hoptimator-operator/src
- main/java/com/linkedin/hoptimator/operator
- subscription
- test/java/com/linkedin/hoptimator/operator
- subscription
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
163 | 163 | | |
164 | 164 | | |
165 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
166 | 169 | | |
167 | 170 | | |
| 171 | + | |
| 172 | + | |
168 | 173 | | |
169 | 174 | | |
170 | 175 | | |
| |||
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
220 | 269 | | |
221 | 270 | | |
222 | 271 | | |
| |||
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
73 | 79 | | |
74 | 80 | | |
75 | 81 | | |
| |||
Lines changed: 13 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
52 | 64 | | |
53 | 65 | | |
54 | 66 | | |
| |||
Lines changed: 10 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
253 | 262 | | |
254 | 263 | | |
255 | 264 | | |
| |||
300 | 309 | | |
301 | 310 | | |
302 | 311 | | |
303 | | - | |
| 312 | + | |
Lines changed: 65 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
84 | 87 | | |
85 | 88 | | |
86 | 89 | | |
| |||
92 | 95 | | |
93 | 96 | | |
94 | 97 | | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
121 | 125 | | |
122 | 126 | | |
123 | 127 | | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| |||
152 | 157 | | |
153 | 158 | | |
154 | 159 | | |
| 160 | + | |
155 | 161 | | |
156 | 162 | | |
157 | 163 | | |
| |||
169 | 175 | | |
170 | 176 | | |
171 | 177 | | |
| 178 | + | |
172 | 179 | | |
173 | 180 | | |
174 | 181 | | |
| |||
189 | 196 | | |
190 | 197 | | |
191 | 198 | | |
| 199 | + | |
192 | 200 | | |
193 | 201 | | |
194 | 202 | | |
| |||
211 | 219 | | |
212 | 220 | | |
213 | 221 | | |
| 222 | + | |
214 | 223 | | |
215 | 224 | | |
216 | 225 | | |
| |||
221 | 230 | | |
222 | 231 | | |
223 | 232 | | |
| 233 | + | |
224 | 234 | | |
225 | 235 | | |
226 | 236 | | |
| |||
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
232 | 296 | | |
233 | 297 | | |
| 298 | + | |
234 | 299 | | |
235 | 300 | | |
236 | 301 | | |
| |||
Lines changed: 30 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
180 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
181 | 191 | | |
182 | 192 | | |
183 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
184 | 198 | | |
185 | 199 | | |
186 | 200 | | |
| |||
239 | 253 | | |
240 | 254 | | |
241 | 255 | | |
242 | | - | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
243 | 267 | | |
244 | 268 | | |
245 | 269 | | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
246 | 274 | | |
247 | 275 | | |
248 | 276 | | |
| |||
Lines changed: 34 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
149 | 156 | | |
150 | 157 | | |
151 | 158 | | |
| |||
233 | 240 | | |
234 | 241 | | |
235 | 242 | | |
236 | | - | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
237 | 254 | | |
238 | 255 | | |
239 | 256 | | |
| |||
313 | 330 | | |
314 | 331 | | |
315 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
316 | 347 | | |
317 | 348 | | |
0 commit comments