Search code examples
xpathsonarquberule

XPath rule not working in Sonar 4.4


reproduce steps:

  1. click "Rules" link
  2. Search "xpath"
  3. click the Java XPath rule that is not deprecated
  4. click "create"
  5. Fill in "name"/"key"/"Description"/"Message" as "should not use Collections.synchronizedMap" , change status as "ready" , set xpathQuery as //IDENTIFIER[@tokenValue='synchronizedMap']

  6. click "create" button

  7. click "edit" and notice "xpathQuery" field is empty which is unexpected.
  8. fill the field "xpathQuery" with //IDENTIFIER[@tokenValue='synchronizedMap'] again
  9. click "save" button
  10. click "edit" and notice "xpathQuery" field is missing totally , which is unexpected.
  11. run sonar runner again code that contains "Map test = Collections.synchronizedMap()"
  12. no issue detected which is unexpected.

As test , Javascript XPath rule doesn't work either, and just test in Sonar 4.3.1 , both Java and Javascript XPath rule works. java plugin version is 2.4

Anyone please give some suggestion or help reporting it to Sonar JIRA where I didn't have permission to report bug.


Solution

  • This is a known bug on SonarQube: SONAR-5575

    Its fix is planned and should be available in a month or so. Feel free to vote and watch for the JIRA ticket.