[Sp 500] - backport of PDI-10424 to 5.0

formatting + fix (separate commits)
unit test has not been back-ported due to lack of test libraries (mockito)