Build started breaking on existing XML code today v7.6.0.3134

xml
sonarcloud
scanner

(Duncan) #1

Seems to be this issue: JavaXmlSensor NPE on XML parsing with <![CDATA[]]>

Version

  • SonarScanner for MSBuild 4.5
  • SonarQube Scanner 3.2.0.1227
  • Java 1.8.0_201 Oracle Corporation (64-bit)
  • Windows 10 10.0 amd64
  • SonarQube server 7.6.0

Repro

  • Run the same build we ran on Friday but today it blows up…
  • Failing code:
<ConfigurationAtom>
  <HtmlHeader>
    <![CDATA[]]>
  </HtmlHeader>
  <Title>Configure Your Payment Gateway</Title>

  <AppConfig Required="false" Advanced="false" FriendlyName="Payment Gateway">
    <Name>PaymentGateway</Name>
  </AppConfig>

  <AppConfig Required="false" Advanced="false" FriendlyName="Backup Payment Gateway">
    <Name>PaymentGatewayBackup</Name>
  </AppConfig>

  <AppConfig Required="false" Advanced="false" FriendlyName="Primary Gateway Retries">
    <Name>PaymentGateway.PrimaryRetries</Name>
  </AppConfig>

  <AppConfig Required="false" Advanced="false" FriendlyName="Backup Gateway Retries">
    <Name>PaymentGateway.BackupRetries</Name>
  </AppConfig>

</ConfigurationAtom>

Workaround

  • none found yet.

Error

[13:54:58] :	 [Step 6/8] 13:54:58.544 INFO: Sensor C# Properties [csharp] (done) | time=1ms
[13:54:58] :	 [Step 6/8] 13:54:58.544 INFO: Sensor JavaXmlSensor [java]
[13:54:58] :	 [Step 6/8] 13:54:58.547 INFO: 46 source files to be analyzed

[13:54:58] :	 [Step 6/8] 13:54:58.553 DEBUG: 'Web/General.Gateway.xml' generated metadata with charset 'UTF-8'
[13:54:58] :	 [Step 6/8] 13:54:58.618 INFO: ------------------------------------------------------------------------
[13:54:58] :	 [Step 6/8] 13:54:58.618 INFO: EXECUTION FAILURE
[13:54:58] :	 [Step 6/8] 13:54:58.618 INFO: ------------------------------------------------------------------------
[13:54:58] :	 [Step 6/8] 13:54:58.618 INFO: Total time: 27.890s
[13:54:58] :	 [Step 6/8] 13:54:58.708 INFO: Final Memory: 35M/547M
[13:54:58]W:	 [Step 6/8] 13:54:58.708 ERROR: Error during SonarQube Scanner execution
[13:54:58] :	 [Step 6/8] 13:54:58.708 INFO: ------------------------------------------------------------------------
[13:54:58]W:	 [Step 6/8] java.lang.NullPointerException
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.analyzer.commons.xml.XmlParser.setLocation(XmlParser.java:254)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.analyzer.commons.xml.XmlParser.finalizePreviousNode(XmlParser.java:172)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.analyzer.commons.xml.XmlParser.parseXml(XmlParser.java:114)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.analyzer.commons.xml.XmlParser.<init>(XmlParser.java:68)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.analyzer.commons.xml.XmlFile.create(XmlFile.java:90)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.plugins.java.XmlFileSensor.scanFile(XmlFileSensor.java:99)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.plugins.java.XmlFileSensor.execute(XmlFileSensor.java:83)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:48)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:85)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:59)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:77)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:59)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:82)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:408)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:403)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:400)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:360)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:126)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:136)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:73)
[13:54:58]W:	 [Step 6/8] 	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:67)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
[13:54:58]W:	 [Step 6/8] 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[13:54:58]W:	 [Step 6/8] 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
[13:54:58]W:	 [Step 6/8] 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
[13:54:58]W:	 [Step 6/8] 	at java.lang.reflect.Method.invoke(Unknown Source)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
[13:54:58]W:	 [Step 6/8] 	at com.sun.proxy.$Proxy0.execute(Unknown Source)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
[13:54:58]W:	 [Step 6/8] 	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
[13:54:58]W:	 [Step 6/8] The SonarQube Scanner did not complete successfully
[13:54:58] :	 [Step 6/8] Process returned exit code 1
[13:54:58] :	 [Step 6/8] 13:54:58.826  Creating a summary markdown file...
[13:54:58]W:	 [Step 6/8] 13:54:58.827  Post-processing failed. Exit code: 1
[13:54:58]W:	 [Step 6/8] Process exited with code 1
[13:54:58]E:	 [Step 6/8] Process exited with code 1 (Step: SonarQube Scan End  (Command Line))
[13:54:58]E:	 [Step 6/8] Step SonarQube Scan End  (Command Line) failed
[13:54:58]W: Step 7/8: Create Packaging Artifacts (PowerShell)
[13:54:58]W:	 [Step 7/8] Build step Create Packaging Artifacts (PowerShell) is skipped because the previous step has failed
[13:54:58] : Step 8/8: Create Deployment Package (PowerShell)
[13:54:58] :	 [Step 8/8] Disabled build step Create Deployment Package (PowerShell) is skipped
[13:54:58] : File content replacer
[13:54:58] :	 [File content replacer] Reverting patched assembly versions
[13:54:58] :		 [Reverting patched assembly versions] Undo changes in: src\GlobalAssemblyInfo.cs.
[13:54:58]i:	 [File content replacer] Checkout directory marked as clean.
[13:54:58] : Publishing internal artifacts
[13:54:59] :	 [Publishing internal artifacts] Publishing 1 file using [ArtifactsCachePublisher]
[13:54:59] :	 [Publishing internal artifacts] Publishing 1 file using [WebPublisher]
[13:54:58]W: Publishing artifacts
[13:54:58] :	 [Publishing artifacts] Collecting files to publish: [build/artifacts/* => packages]
[13:54:59]W:	 [Publishing artifacts] Artifacts path 'build/artifacts/*' not found
[13:54:59] : Build finished

(Michael Gumowski) #2

Hello @duncanc,

Thanks for the feedback. The issue has already been reported and is related to the empty CDATA that you have on 3rd line of the XML file. You can check the related conversation here:

Unfortunately, the only current workaround is to slightly modify the file, by inlining the CDATA tag within such as <HtmlHeader><![CDATA[]]></HtmlHeader>.

See related tickets to be handled soon:


(Duncan) #3

Thanks Michael, I noted that bug report in my initial post but what was weird is it just started breaking yesterday on the same code that was evaluated successfully last week so I made the assumption that “something is breaking now so something changed”.

Thanks for the JIRA link - I couldn’t tell whether the bug had an attempted fix in the latest release from the other forum post. Maybe I missed it.

Edit: I missed the jira link in the other post and didn’t click through to determine the status.

Still weird that it’s breaking now with no code changes on our end.
Maybe I misunderstood what version the bug report was targeting.


(Michael Gumowski) #4

Hey,

I initially assigned the ticket to the next version of SonarJava/SonarXML; However we agreed yesterday that the issue was way too important to wait next iteration and release of these analyzers. I consequently changed the fix version of ticket SONARJAVA-3022 to 5.10.2 of SonarJava, to at least stop failing abruptly analysis.

Ticket has been fixed yesterday. The release should be available in a few hours (and deployed on SonarCloud).

Regarding the file starting to fail only recently, I guess it’s related to a recent update of SonarJava, without any new analysis in between.

Cheers,
Michael


(Duncan) #5

Thanks, yeah we were unable to run analysis without modifying code in a few different places - just to make analysis work - so I appreciate the quick fix!


S2631, s2083, s3649, s2091 "EXECUTION FAILURE"