Commit 312f1bd
fix(metadata): DATE-array null-element read + pin scalar-on-array-field widening (#275)
Review fix round 1 on the #275 DATE-array storage gap fix.
Important #1: MetaObjectDeserializer's readDateElement fell through to
el.getAsString() for a JsonNull element (JsonNull is not a JsonPrimitive),
which throws UnsupportedOperationException naming no field -- the same
bare-throw shape C1 eliminated on the write side. Reachable by design:
MetaObjectSerializer deliberately emits JsonNull.INSTANCE at a null
element position (pinned by an existing test), so the serializer's own
output could not be read back by its sibling deserializer. Fixed with an
isJsonNull() guard as the first line of readDateElement, matching what
write already emits; added a full-pipeline null-element round-trip test;
corrected the readFieldValue DATE-case comment that (falsely) claimed the
branch already round-tripped end to end.
Important #2: the report's blast-radius argument conflated "no-op for a
non-array field" with "no-op for every setObject call site" --
getEffectiveDataType() == getDataType() is a property of the field, not
the value. An array-typed field receiving a scalar JSON value (live in
MetaObjectDeserializer's own else-arms) genuinely changed from a loud
InvalidValueException to a silent single-element wrap (or, for STRING, a
comma-split) -- verified both directions by temporarily reverting the E2
fix and confirming the old exception. Not a new rule: it converges with
DataObjectBase._setObjectAttribute's pre-existing effective-type
conversion, which is what produced this task's own E1 RED evidence in the
first place. Added six pinning tests and corrected the report's claim in
place.
Refs #275
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015TqsuDye2SfXGf43vuoD3n1 parent 4f46470 commit 312f1bd
2 files changed
Lines changed: 106 additions & 3 deletions
File tree
- server/java/metadata/src
- main/java/com/metaobjects/io/object/gson
- test/java/com/metaobjects/io/object/gson
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
130 | 130 | | |
131 | 131 | | |
132 | 132 | | |
133 | | - | |
134 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
135 | 137 | | |
136 | 138 | | |
137 | 139 | | |
| |||
201 | 203 | | |
202 | 204 | | |
203 | 205 | | |
204 | | - | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
205 | 211 | | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
206 | 215 | | |
207 | 216 | | |
208 | 217 | | |
| |||
server/java/metadata/src/test/java/com/metaobjects/io/object/gson/GsonArrayWriteRoundTripTest.java
Lines changed: 94 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
349 | 371 | | |
350 | 372 | | |
351 | 373 | | |
| |||
454 | 476 | | |
455 | 477 | | |
456 | 478 | | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
457 | 551 | | |
0 commit comments