问题
reproduce steps:
- click "Rules" link
- Search "xpath"
- click the Java XPath rule that is not deprecated
- click "create"
Fill in "name"/"key"/"Description"/"Message" as "should not use Collections.synchronizedMap" , change status as "ready" , set xpathQuery as
//IDENTIFIER[@tokenValue='synchronizedMap']
click "create" button
- click "edit" and notice "xpathQuery" field is empty which is unexpected.
- fill the field "xpathQuery" with
//IDENTIFIER[@tokenValue='synchronizedMap']
again - click "save" button
- click "edit" and notice "xpathQuery" field is missing totally , which is unexpected.
- run sonar runner again code that contains "Map test = Collections.synchronizedMap()"
- 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.
回答1:
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.
来源:https://stackoverflow.com/questions/25887057/xpath-rule-not-working-in-sonar-4-4