File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
engine/src/main/java/org/hibernate/validator/internal/engine Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -192,7 +192,7 @@ public final void setCurrentGroup(Class<?> currentGroup) {
192
192
}
193
193
194
194
public final void setCurrentValidatedValue (V currentValue ) {
195
- propertyPath .setLeafNodeValue ( currentValue );
195
+ propertyPath .setLeafNodeValueIfRequired ( currentValue );
196
196
this .currentValue = currentValue ;
197
197
}
198
198
Original file line number Diff line number Diff line change @@ -222,13 +222,16 @@ public NodeImpl makeLeafNodeIterableAndSetMapKey(Object key) {
222
222
return currentLeafNode ;
223
223
}
224
224
225
- public NodeImpl setLeafNodeValue (Object value ) {
226
- requiresWriteableNodeList ();
225
+ public NodeImpl setLeafNodeValueIfRequired (Object value ) {
226
+ // The value is only exposed for property and container element nodes
227
+ if ( currentLeafNode .getKind () == ElementKind .PROPERTY || currentLeafNode .getKind () == ElementKind .CONTAINER_ELEMENT ) {
228
+ requiresWriteableNodeList ();
227
229
228
- currentLeafNode = NodeImpl .setPropertyValue ( currentLeafNode , value );
230
+ currentLeafNode = NodeImpl .setPropertyValue ( currentLeafNode , value );
229
231
230
- nodeList .set ( nodeList .size () - 1 , currentLeafNode );
231
- hashCode = -1 ;
232
+ nodeList .set ( nodeList .size () - 1 , currentLeafNode );
233
+ hashCode = -1 ;
234
+ }
232
235
return currentLeafNode ;
233
236
}
234
237
You can’t perform that action at this time.
0 commit comments