Skip to content

Commit 88ca4c9

Browse files
Copilotsbrunner
andcommitted
Improve comment for ObjectMissingException throw
Add detailed comment explaining why ObjectMissingException is thrown for empty default values, clarifying the rationale for the framework. Co-authored-by: sbrunner <353872+sbrunner@users.noreply.github.com>
1 parent 22258b0 commit 88ca4c9

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

core/src/main/java/org/mapfish/print/attribute/ReflectiveAttribute.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,12 @@ public Object getValue(
441441
throw new IllegalArgumentException(message);
442442
}
443443
pValue = this.getDefaultValue();
444-
// If the attribute is missing from the request and has no meaningful default,
445-
// throw ObjectMissingException to let the framework handle it properly
444+
// If the attribute is missing from the request and has no meaningful default
445+
// (i.e., the default value is an empty object), throw ObjectMissingException.
446+
// This prevents attempting to parse an empty object which would trigger
447+
// OneOf validation errors for required fields. The framework will handle this
448+
// by either throwing MissingPropertyException for required attributes or
449+
// skipping optional attributes.
446450
if (pValue != null && !pValue.keys().hasNext()) {
447451
throw new ObjectMissingException(
448452
requestJsonAttributes, attributeName);

0 commit comments

Comments
 (0)