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) {
192192 }
193193
194194 public final void setCurrentValidatedValue (V currentValue ) {
195- propertyPath .setLeafNodeValue ( currentValue );
195+ propertyPath .setLeafNodeValueIfRequired ( currentValue );
196196 this .currentValue = currentValue ;
197197 }
198198
Original file line number Diff line number Diff line change @@ -222,13 +222,16 @@ public NodeImpl makeLeafNodeIterableAndSetMapKey(Object key) {
222222 return currentLeafNode ;
223223 }
224224
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 ();
227229
228- currentLeafNode = NodeImpl .setPropertyValue ( currentLeafNode , value );
230+ currentLeafNode = NodeImpl .setPropertyValue ( currentLeafNode , value );
229231
230- nodeList .set ( nodeList .size () - 1 , currentLeafNode );
231- hashCode = -1 ;
232+ nodeList .set ( nodeList .size () - 1 , currentLeafNode );
233+ hashCode = -1 ;
234+ }
232235 return currentLeafNode ;
233236 }
234237
You can’t perform that action at this time.
0 commit comments