@@ -126,14 +126,14 @@ protected void readFieldValue(MetaObject mo, MetaField mf, Object vo,
126126 // nothing that parsed before stops parsing). String -> tolerant ISO parse
127127 // (TemporalWireFormat). Array: element-wise into a List<Date> via
128128 // setObjectArray, skipping context.deserialize(el, List.class), which yields a
129- // type-losing List<Double>. setObjectArray only bypasses MetaField's OWN
130- // DataConverter.toType call; setObjectAttribute still routes through
131- // AbstractObjectRepresentation.setValue, which unconditionally applies
132- // DataConverter.toType(effectiveDataType, value) -- and DataConverter's
133- // DATE_ARRAY case is unimplemented (unsupported()). So today this branch
134- // throws UnsupportedOperationException for a non-empty date array on the
135- // default (non-proxy) representation path; it becomes correct once
136- // DataConverter grows a DATE_ARRAY conversion .
129+ // type-losing List<Double>. setObjectArray routes through
130+ // AbstractObjectRepresentation.setValue, which applies
131+ // DataConverter.toType(effectiveDataType, value) -- backed, since the #275
132+ // carry-forward unit, by DataConverter.toDateArray. This branch genuinely
133+ // round-trips a date array end to end today, INCLUDING a null element (see
134+ // readDateElement's isJsonNull() guard -- required because the write side,
135+ // MetaObjectSerializer, deliberately emits JsonNull.INSTANCE at a null element
136+ // position; see GsonArrayWriteRoundTripTest's Step 3b/A6 coverage) .
137137 if (mf .isArrayType () && el .isJsonArray ()) {
138138 List <Date > dates = new ArrayList <>();
139139 for (JsonElement item : el .getAsJsonArray ()) {
@@ -203,8 +203,15 @@ protected void readFieldValue(MetaObject mo, MetaField mf, Object vo,
203203 }
204204 }
205205
206- /** Single JSON array element of a DATE-array field: number -> epoch millis, string -> tolerant ISO parse. */
206+ /** Single JSON array element of a DATE-array field: null -> null (JsonNull.getAsString()
207+ * throws UnsupportedOperationException, so this must be checked before isJsonPrimitive --
208+ * JsonNull is not a JsonPrimitive), number -> epoch millis, string -> tolerant ISO parse.
209+ * Mirrors what MetaObjectSerializer.writeField's DATE-array branch emits at a null element
210+ * position (JsonNull.INSTANCE), so a null element round-trips instead of throwing. */
207211 private Date readDateElement (MetaField mf , JsonElement el ) {
212+ if (el .isJsonNull ()) {
213+ return null ;
214+ }
208215 if (el .isJsonPrimitive () && el .getAsJsonPrimitive ().isNumber ()) {
209216 return new Date (el .getAsLong ());
210217 }
0 commit comments