JBIDE-16422 - Fixing sonar issues in RS (not WS) code

Fixing 'critical' issues plus a bunch of 'major' ones
Added more unit tests for edge cases (null args in method calls)