I have the following line of code in my visualforce controller.
caseId = ApexPages.currentPage().getParameters().get('caseId');
I am using PMD, which is a static code analyzer. It complains me of
ApexXSSFromURLParam: Apex classes should escape/sanitize Strings obtained from URL parameters.
I studied a bit on this and found that
String.escapeSingleQuotes is a useful way to avoid SOQL injection attacks. So I rewrote it as follows:
caseId = String.escapeSingleQuotes(ApexPages.currentPage().getParameters().get('caseId'));
But PMD is still complaining me about the same issue.
Is there anything else that I need to do in order to escape/sanitize the string?