Fixed
Details
Assignee
Marko BekhtaMarko BekhtaReporter
Jay GorrellJay GorrellBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Feedback Requested
May 15, 2023Participants
Jay GorrellMarko BekhtaComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Marko Bekhta
Marko BekhtaReporter
Jay Gorrell
Jay GorrellBug Testcase Reminder (view)
Bug reports should generally be accompanied by a test case!
Bug Testcase Reminder (edit)
Bug reports should generally be accompanied by a test case!
Feedback Requested
May 15, 2023
Participants
Jay Gorrell
Marko Bekhta
Components
Fix versions
Affects versions
Priority
Created May 2, 2023 at 12:55 AM
Updated August 1, 2024 at 8:38 AM
Resolved July 21, 2024 at 1:21 PM
hen calling Validator.validateValue() with a class containing an array field with a single Pattern validation on the entire array which creates violations, the index in the path of the validations is only correct for the last item in the array. The index for the violations on other elements is always set to the index of the last element.
I spent some time debugging this and found the PathImpl.createCopy(), which calls the copy constructor PathImpl(PathImpl path), is only doing a shallow copy of the values. The validation for each element in the array is using the same instance of the nodeList property in PathImpl instead of a different one for each validation. This happens because the copy constructor does not create a new list, but uses the existing one. The code that changes the currentLeafNode values is then update that list which ends up in each violation path.
I believe the fix to be on line 351 of PathImpl in the 6.0.23.Final code would be to replace that line with this one.:
nodeList = new ArrayList<path.nodeList>() // Need null check for path.nodeList?