[CXF-6089] Reworking the fix to avoid regressions and adding an additional testcase from Rebecca