Since I’ve upgraded my SonarQube instance to version 6.x LTS and updated my SonarXML plugin I get an exception when the XmlSensor tries to highlight some XML code. I’ve neved had problems with those XML files before the upgrade.
Versions used and project config:
- SonarQube Maven Plugin:
- pom source-enconding:
- source file enconding:
- This simple XML file produces an exception when analizing (I’ve simplified the original one just to focus on the problem):
<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE menu [ <!-- Some comment --> <!ELEMENT menu (modulo)* > ]> <menu> </menu>
- This is the exception I get:
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:184.108.40.2064:sonar (default-cli) on project foo: Unable to analyse file C:/tmp/foo/include/foo.xml: Unable to highlight file include/foo.xml: 5 is not a valid line offset for pointer. File include/foo.xml has 2 character(s) at line 7 -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:220.127.116.114:sonar (default-cli) on project foo: Unable to analyse file C:/tmp/foo/include/foo.xml
Steps to reproduce
- Analize the provided xml with a SonarQube Maven Scanner
- Based on several tests I’ve performed, my guess is that the exception raises when the XML file has a multiline comment and the starting delimiter is followed by a new line, with no whitespace between.
- If you write a whitespace between the starting delimiter and the newline
"<!-- "you’ll be able to avoid the exception.
Can you confirm this bug?