gretard / sonar-ps-plugin

Powershell language plugin for SonarQube
GNU Lesser General Public License v3.0
37 stars 7 forks source link

WARN: Unexpected exception while running analysis #2

Closed cmenzi closed 5 years ago

cmenzi commented 6 years ago

Hi

When running the analysis I get the following warning after analysis:

WARN: Unexpected exception while running analysis
javax.xml.bind.UnmarshalException: null
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(AbstractUnmarshallerImpl.java:335)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(UnmarshallerImpl.java:563)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:249)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:157)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:162)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:171)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:189)
    at org.sonar.plugins.powershell.ScriptAnalyzerSensor.execute(ScriptAnalyzerSensor.java:72)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:288)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:283)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:261)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:177)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:400)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(XMLScanner.java:1472)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:1014)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
    ... 38 common frames omitted

What are we doing wrong?

gretard commented 6 years ago

Hello,

Thank you for raising issue. Could you provide more details:

cmenzi commented 6 years ago

Hi

INFO: SonarQube Scanner 3.1.0.1141
INFO: Java 1.8.0_162 Oracle Corporation (64-bit)
INFO: Windows Server 2016 10.0 amd64
INFO: User cache: C:\Users\ContainerAdministrator\.sonar\cache
INFO: SonarQube server 6.7.3
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Quality profile for ps: Sonar Way
INFO: Sensor ScriptAnalyzerSensor [ps]
INFO: Starting running powershell analysis: (Invoke-ScriptAnalyzer -Path 'C:\glr\b\9e7218d1\0\x\y' -Recurse | Select-Object RuleName, Message, Line, Column, Severity, @{Name='File';Expression={$_.Extent.File }} | ConvertTo-Xml).Save('C:\glr\b\9e7218d1\0\x\y\.scannerwork\.sonartmp\7431552642098919773.tmp')
INFO: Finished running powershell analysis
WARN: Unexpected exception while running analysis
... StackTrace from above.

Source Code: x-iot-azure-recipes.zip

gretard commented 6 years ago

Hi,

Thank you for your reply. Which PowerShell version are you using? I would like to try to reproduce the issue. :)

ktraister commented 6 years ago

Hate to Necrobump, but I'm getting this error as well. I'm on PowerShell 5.1 and plugin version 0.3.0 built from the master branch of this repo

gretard commented 6 years ago

Thank you, for raising this. Will take a look this into soon.

On Fri, Sep 21, 2018, 9:33 PM Keith notifications@github.com wrote:

Hate to Necrobump, but I'm getting this error as well. I'm on PowerShell 5.1 and plugin version 0.3.0 built from the master branch of this repo

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gretard/sonar-ps-plugin/issues/2#issuecomment-423632227, or mute the thread https://github.com/notifications/unsubscribe-auth/ATdW_NkXtGNFMyN3U-I9G5Kb-mWVE092ks5udTETgaJpZM4UVGuV .

ktraister commented 6 years ago

I did some troubleshooting on this today, but only enough to find that the file I was trying to read had been created. I was having trouble reading from the file (Java is a new language for me), so I'm not sure if my code was bad or I was just reading an empty file.

gretard commented 6 years ago

Hi,

I think it was just an empty file. Could you provide more details? What OS have you been using? Did the analysis finish? Also, did you check if in SonarQube project is shown ?

On Sat, Sep 22, 2018 at 1:10 AM Keith notifications@github.com wrote:

I did some troubleshooting on this today, but only enough to find that the file I was trying to read had been created. I was having trouble reading from the file (Java is a new language for me), so I'm not sure if my code was bad or I was just reading an empty file.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/gretard/sonar-ps-plugin/issues/2#issuecomment-423684362, or mute the thread https://github.com/notifications/unsubscribe-auth/ATdW_HltcMTksRh6GZDdbaUS7e-0Xa0tks5udWPUgaJpZM4UVGuV .

ktraister commented 6 years ago

This is a Windows 10 Jenkins build slave that we're using for analysis. The analysis finished successfully, and the SonarQube project shows that code was scanned, but nothing was found.

We've had some previous weirdness with PS in this Windows slave, mostly because we have 5.1 and 6 installed, and depending on how we call PS we can get either. Don't beat your head against the code too hard, I'm starting to think there's an issue with the PS install on the build slave. I'll do some digging on this today.

ktraister commented 6 years ago

Looks like we're on PowerShell 5.1, and after making sure the plugin is installed I'm still getting the same behavior

gretard commented 6 years ago

Hi, I would suggest trying on build machine to run PSScriptAnalyzer manually by using command:

Invoke-ScriptAnalyzer -Path 'C:\glr\b\9e7218d1\0\x\y' -Recurse

to verify that it works and anything is found. If anything is found, then maybe you could run Sonarqube plugin with Debug (-X option) mode enabled and maybe attach it here?

ktraister commented 6 years ago
screen shot 2018-09-24 at 2 10 56 pm

When I ran the command as you posted it, It fell on it's face. Running it with the correct path produced the correct output

ktraister commented 6 years ago
16:00:55.547 INFO: 137 files indexed
16:00:55.548 INFO: Quality profile for ps: Sonar Way
16:00:56.758 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
16:00:56.759 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
16:00:56.822 DEBUG: 'C#' skipped because there is no related file in current project
16:00:56.822 DEBUG: 'C# Properties' skipped because there is no related file in current project
16:00:56.823 DEBUG: 'C# Tests Coverage Report Import' skipped because there is no related file in current project
16:00:56.823 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
16:00:56.824 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
16:00:56.824 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
16:00:56.824 DEBUG: 'PylintSensor' skipped because there is no related file in current project
16:00:56.825 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
16:00:56.825 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
16:00:56.826 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
16:00:56.826 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
16:00:56.826 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
16:00:56.826 DEBUG: 'Flex' skipped because there is no related file in current project
16:00:56.827 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
16:00:56.827 DEBUG: 'XML Sensor' skipped because there is no related file in current project
16:00:56.827 DEBUG: 'PHP sensor' skipped because there is no related file in current project
16:00:56.827 DEBUG: 'Analyzer for "php.ini" files' skipped because there is no related file in current project
16:00:56.828 DEBUG: 'SonarTS' skipped because there is no related file in current project
16:00:56.828 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
16:00:56.828 DEBUG: 'SonarJS' skipped because there is no related file in current project
16:00:56.828 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
16:00:56.830 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
16:00:56.830 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
16:00:56.835 DEBUG: 'C#' skipped because there is no related file in current project
16:00:56.836 DEBUG: 'C# Properties' skipped because there is no related file in current project
16:00:56.836 DEBUG: 'C# Tests Coverage Report Import' skipped because there is no related file in current project
16:00:56.836 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
16:00:56.836 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
16:00:56.836 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
16:00:56.836 DEBUG: 'PylintSensor' skipped because there is no related file in current project
16:00:56.836 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'Flex' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'XML Sensor' skipped because there is no related file in current project
16:00:56.837 DEBUG: 'PHP sensor' skipped because there is no related file in current project
16:00:56.838 DEBUG: 'Analyzer for "php.ini" files' skipped because there is no related file in current project
16:00:56.838 DEBUG: 'SonarTS' skipped because there is no related file in current project
16:00:56.838 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
16:00:56.838 DEBUG: 'SonarJS' skipped because there is no related file in current project
16:00:56.838 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
16:00:56.842 DEBUG: Sensors : ScriptAnalyzerSensor -> TokenizerSensor -> SonarJavaXmlFileSensor -> Zero Coverage Sensor -> CPD Block Indexer
16:00:56.842 INFO: Sensor ScriptAnalyzerSensor [ps]
16:00:56.850 INFO: Starting running powershell analysis: C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps2142485453349140047scriptAnalyzer.ps1 -inputDir C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test -output C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\979994375791477621.tmp
16:00:56.850 INFO: ~~~~~~~~~~~~~~~ DEBUG ~~~~~~~~~~~~~~~~~~~~
16:00:57.155 INFO: OUTPUT: 
16:00:57.155 INFO: ~~~~~~~~~~~~~~~ END DEBUG ~~~~~~~~~~~~~~~~
16:00:57.155 INFO: Finished running powershell analysis
16:00:57.207 WARN: Unexpected exception while running analysis
javax.xml.bind.UnmarshalException: null
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at org.sonar.plugins.powershell.ScriptAnalyzerSensor.execute(ScriptAnalyzerSensor.java:97)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:302)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:297)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:271)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    ... 39 common frames omitted

16:00:57.207 INFO: Sensor ScriptAnalyzerSensor [ps] (done) | time=365ms
16:00:57.207 INFO: Sensor TokenizerSensor [ps]
16:00:57.210 DEBUG: Running C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps8365167894211038982parser.ps1 -inputFile C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Install.ps1 -output C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\5105619957321494360.tmp command
16:00:57.624 DEBUG: 'Examples/Example-Install.ps1' generated metadata  with charset 'windows-1252'
16:00:57.653 DEBUG: Running analysis for C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Install.ps1 to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\5105619957321494360.tmp finished.
16:00:57.655 DEBUG: Running C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps8365167894211038982parser.ps1 -inputFile C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Main.ps1 -output C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\3673011911228920025.tmp command
16:00:58.007 DEBUG: 'Examples/Example-Main.ps1' generated metadata  with charset 'windows-1252'
16:00:58.010 DEBUG: Running analysis for C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Main.ps1 to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\3673011911228920025.tmp finished.
16:00:58.011 DEBUG: Running C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps8365167894211038982parser.ps1 -inputFile C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Sync.ps1 -output C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\811818091705008841.tmp command
16:00:58.348 DEBUG: 'Examples/Example-Sync.ps1' generated metadata  with charset 'windows-1252'
16:00:58.353 DEBUG: Running analysis for C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Sync.ps1 to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\811818091705008841.tmp finished.
16:00:58.354 DEBUG: Running C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps8365167894211038982parser.ps1 -inputFile C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Format-XML.ps1 -output C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\5458830618611004269.tmp command
16:00:58.724 DEBUG: 'Functions/Private/Format-XML.ps1' generated metadata  with charset 'windows-1252'
16:00:58.731 DEBUG: Running analysis for C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Format-XML.ps1 to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\5458830618611004269.tmp finished.
ktraister commented 6 years ago

That's the pertinent logs from Jenkins, the '~~ DEBUG ~~' is something I baked in for testing the output of the command that creates the file we're trying to unmarshall.

gretard commented 6 years ago

Hi, thank you for output. I did some changes how files are handled. Could you try running analysis with 0.3.1 plugin version version?

ktraister commented 6 years ago

No dice, still seeing the error. 0.3.1 output:

17:49:25.595 INFO: Quality profile for ps: Sonar Way
17:49:26.486 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
17:49:26.486 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
17:49:26.497 DEBUG: 'C#' skipped because there is no related file in current project
17:49:26.499 DEBUG: 'C# Properties' skipped because there is no related file in current project
17:49:26.501 DEBUG: 'C# Tests Coverage Report Import' skipped because there is no related file in current project
17:49:26.501 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
17:49:26.504 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
17:49:26.504 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
17:49:26.505 DEBUG: 'PylintSensor' skipped because there is no related file in current project
17:49:26.506 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
17:49:26.506 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
17:49:26.508 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
17:49:26.509 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
17:49:26.513 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
17:49:26.513 DEBUG: 'Flex' skipped because there is no related file in current project
17:49:26.513 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
17:49:26.514 DEBUG: 'XML Sensor' skipped because there is no related file in current project
17:49:26.514 DEBUG: 'PHP sensor' skipped because there is no related file in current project
17:49:26.515 DEBUG: 'Analyzer for "php.ini" files' skipped because there is no related file in current project
17:49:26.515 DEBUG: 'SonarTS' skipped because there is no related file in current project
17:49:26.515 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
17:49:26.515 DEBUG: 'SonarJS' skipped because there is no related file in current project
17:49:26.515 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
17:49:26.517 DEBUG: 'Generic Coverage Report' skipped because one of the required properties is missing
17:49:26.517 DEBUG: 'Generic Test Executions Report' skipped because one of the required properties is missing
17:49:26.518 DEBUG: 'C#' skipped because there is no related file in current project
17:49:26.519 DEBUG: 'C# Properties' skipped because there is no related file in current project
17:49:26.519 DEBUG: 'C# Tests Coverage Report Import' skipped because there is no related file in current project
17:49:26.519 DEBUG: '[Deprecated] C# Integration Tests Coverage Report Import' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'C# Unit Test Results Import' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'Python Squid Sensor' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'PylintSensor' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'PylintImportSensor' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'PythonXUnitSensor' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'SurefireSensor' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'JaCoCoSensor' skipped because there is no related file in current project
17:49:26.520 DEBUG: 'JavaSquidSensor' skipped because there is no related file in current project
17:49:26.523 DEBUG: 'Flex' skipped because there is no related file in current project
17:49:26.523 DEBUG: 'Flex Cobertura' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'XML Sensor' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'PHP sensor' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'Analyzer for "php.ini" files' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'SonarTS' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'SonarTS Coverage' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'SonarJS' skipped because there is no related file in current project
17:49:26.524 DEBUG: 'SonarJS Coverage' skipped because there is no related file in current project
17:49:26.528 DEBUG: Sensors : ScriptAnalyzerSensor -> TokenizerSensor -> SonarJavaXmlFileSensor -> Zero Coverage Sensor -> CPD Block Indexer
17:49:26.528 INFO: Sensor ScriptAnalyzerSensor [ps]
17:49:26.536 INFO: Starting Script-Analyzer using powershell: [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps6333045538181498298scriptAnalyzer.ps1, -inputDir, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test, -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\8836023087676428316.tmp]
17:49:26.918 WARN: Unexpected exception while running analysis
javax.xml.bind.UnmarshalException: null
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.createUnmarshalException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.createUnmarshalException(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown Source)
    at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(Unknown Source)
    at org.sonar.plugins.powershell.sensors.ScriptAnalyzerSensor.execute(ScriptAnalyzerSensor.java:84)
    at org.sonar.scanner.sensor.SensorWrapper.analyse(SensorWrapper.java:53)
    at org.sonar.scanner.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:88)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:82)
    at org.sonar.scanner.phases.SensorsExecutor.execute(SensorsExecutor.java:68)
    at org.sonar.scanner.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:88)
    at org.sonar.scanner.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:180)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.scan.ProjectScanContainer.scan(ProjectScanContainer.java:302)
    at org.sonar.scanner.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:297)
    at org.sonar.scanner.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:271)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
    at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
    at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
    at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
    at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
    at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
    at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
    at com.sun.proxy.$Proxy0.execute(Unknown Source)
    at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
    at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
    at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
    at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: org.xml.sax.SAXParseException: Premature end of file.
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.fatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLScanner.reportFatalError(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    ... 39 common frames omitted

17:49:26.918 INFO: Sensor ScriptAnalyzerSensor [ps] (done) | time=390ms
17:49:26.918 INFO: Sensor TokenizerSensor [ps]
17:49:26.922 DEBUG: Running [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps7514036744813990746parser.ps1, -inputFile, 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Install.ps1', -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\899398494356469705.tmp] command
17:49:27.365 DEBUG: 'Examples/Example-Install.ps1' generated metadata  with charset 'windows-1252'
17:49:27.387 DEBUG: Running analysis for 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Install.ps1' to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\899398494356469705.tmp finished.
17:49:27.388 DEBUG: Running [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps7514036744813990746parser.ps1, -inputFile, 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Main.ps1', -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\7254444625773892954.tmp] command
17:49:27.817 DEBUG: 'Examples/Example-Main.ps1' generated metadata  with charset 'windows-1252'
17:49:27.826 DEBUG: Running analysis for 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Main.ps1' to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\7254444625773892954.tmp finished.
17:49:27.827 DEBUG: Running [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps7514036744813990746parser.ps1, -inputFile, 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Sync.ps1', -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\6921931155492085344.tmp] command
17:49:28.245 DEBUG: 'Examples/Example-Sync.ps1' generated metadata  with charset 'windows-1252'
17:49:28.247 DEBUG: Running analysis for 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Examples\Example-Sync.ps1' to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\6921931155492085344.tmp finished.
17:49:28.248 DEBUG: Running [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps7514036744813990746parser.ps1, -inputFile, 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Format-XML.ps1', -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\2114092139466042167.tmp] command
17:49:28.678 DEBUG: 'Functions/Private/Format-XML.ps1' generated metadata  with charset 'windows-1252'
17:49:28.685 DEBUG: Running analysis for 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Format-XML.ps1' to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\2114092139466042167.tmp finished.
17:49:28.686 DEBUG: Running [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps7514036744813990746parser.ps1, -inputFile, 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Get-HabBind.ps1', -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\2432284979142228371.tmp] command
17:49:29.128 DEBUG: 'Functions/Private/Get-HabBind.ps1' generated metadata  with charset 'windows-1252'
17:49:29.136 DEBUG: Running analysis for 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Get-HabBind.ps1' to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\2432284979142228371.tmp finished.
17:49:29.137 DEBUG: Running [powershell.exe, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\ps7514036744813990746parser.ps1, -inputFile, 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Get-HabPackageParam.ps1', -output, C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\4138711521827726583.tmp] command
17:49:29.545 DEBUG: 'Functions/Private/Get-HabPackageParam.ps1' generated metadata  with charset 'windows-1252'
17:49:29.552 DEBUG: Running analysis for 'C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\Functions\Private\Get-HabPackageParam.ps1' to C:\hab\svc\jenkins-slave\data\workspace\workspace\sonar_test\.scannerwork\.sonartmp\4138711521827726583.tmp finished.
gretard commented 6 years ago

Hi, I managed to reproduce the issue with Powershell 6 version. I would suggest trying to update PSScript analyzer and Powershell if you are using Powershell 6 version. Also, I have updated 0.3.1 version jar with some additional logging. Could you reinstall that and run with -X option to see what kind of error/output is generated by the plugin? :)

ktraister commented 6 years ago

It seems that we're having an issue with PS6 on our build slaves right now, I'm working on fixing that. Now we're getting powershell errors that mean something instead of stack traces, which is really helpful! Nice feature!

Once I have the PS6 issues straitened out, I'll comment here

gretard commented 6 years ago

I would suggest updating Powershell version to the latest :)

ktraister commented 5 years ago

🥇