Skip to content
This repository has been archived by the owner on Jul 8, 2019. It is now read-only.

java.lang.NullPointerException after upgrade to Sonar v5.6 and plugin v0.96 #74

Closed
tim-barber-bjss opened this issue Dec 13, 2016 · 9 comments

Comments

@tim-barber-bjss
Copy link

Hi,

I've upgraded to Sonar v5.6 and I'm now using v0.96 of the plugin, this was from v5.1 and v0.90. With the old setup I was able to use the plugin, but now I'm getting the following exception. Nothing has changed in my source code or sonar-project.properties file after the upgrade.

Do you have any ideas as to why this might be happening?

.... .... .... 11:19:12.676 INFO: 136/136 files analyzed 11:19:12.676 INFO: Sensor SCM Sensor (wrapped) (done) | time=2000ms 11:19:12.676 INFO: Sensor Linting sensor for TypeScript files (wrapped) 11:19:12.676 DEBUG: Path sonar.ts.tslintpath not specified, falling back to node_modules/tslint/bin/tslint 11:19:12.676 DEBUG: Found sonar.ts.tslintconfigpath Lint path to be 'tslint.json' 11:19:12.676 DEBUG: Path sonar.ts.tslintrulesdir not specified, falling back to null 11:19:12.676 DEBUG: Using a temporary path for TsLint output: C:\git\XXX\WebComponents\.sonar\.sonartmp\4237565016734021207.tmp 11:19:12.676 DEBUG: Split 134 files into 4 batches for processing 11:19:12.676 DEBUG: Executing TsLint with command: node .... 11:19:16.005 DEBUG: Executing TsLint with command: node .... 11:19:19.363 DEBUG: Executing TsLint with command: node .... 11:19:22.379 DEBUG: Executing TsLint with command: node .... 11:19:23.692 INFO: ------------------------------------------------------------------------ 11:19:23.692 INFO: EXECUTION FAILURE 11:19:23.692 INFO: ------------------------------------------------------------------------ 11:19:23.692 INFO: Total time: 16.313s 11:19:23.739 INFO: Final Memory: 42M/106M 11:19:23.739 INFO: ------------------------------------------------------------------------ 11:19:23.739 ERROR: Error during SonarQube Scanner execution 12:10:50.163 ERROR: Error during SonarQube Scanner execution java.lang.NullPointerException at com.pablissimo.sonar.TsLintParserImpl.parse(TsLintParserImpl.java:26) at com.pablissimo.sonar.TsLintSensor.execute(TsLintSensor.java:104) at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57) at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58) at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50) at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:83) at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:192) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241) at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:236) at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:226) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47) at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86) at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:142) at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127) at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106) at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119) at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:62) 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:233) at org.sonarsource.scanner.api.EmbeddedScanner.runAnalysis(EmbeddedScanner.java:151) at org.sonarsource.scanner.cli.Main.runAnalysis(Main.java:110) at org.sonarsource.scanner.cli.Main.execute(Main.java:74) at org.sonarsource.scanner.cli.Main.main(Main.java:61)

@ThielenB
Copy link

Could be caused by some permission issue. Take a look at this thread for details, maybe it helps

@bootrider
Copy link

It could be related to permissions as some guys pointe in a similar thread.

But if you have a project with 0 Issues, the NullPointerException will be rised

@Pablissimo add this test case to TsLintParserTest.Java file

@Test
    public void parseAGoodProjectWithNoIssues() {
        List<String> toParse = new ArrayList<String>();
        toParse.add("");
                
        Map<String, List<TsLintIssue>> issues = new TsLintParserImpl().parse(toParse);
        
        assertEquals(0, issues.size());        
    }

@Pablissimo
Copy link
Owner

Quality, thanks @bootrider

@tim-barber-bjss
Copy link
Author

Hi,

I've installed v0.98 and this now appears to be resolved.

Thanks

@navinprasadk
Copy link

Hi team..
I am facing the following error while executing Sonar Runner ( sonar-runner.bat -X)

I have configured the sonar-project file so that it could be use the .jsx file:

# must be unique in a given SonarQube instance
sonar.projectKey=Adapt27

# this is the name and version displayed in the SonarQube UI. Was mandatory prior to SonarQube 6.1.
sonar.projectName=Adapt
sonar.projectVersion=1.0
 sonar.javascript.file.suffixes=.js,.jsx
sonar.sources=server,webclient
# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8

**We are using the following version** 

sonar qube server 5.6.6
sonar-javascript-plugin-3.1.1.5128


INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 57.625s
Final Memory: 9M/247M
INFO: ------------------------------------------------------------------------
ERROR: Error during Sonar runner execution
org.sonar.runner.impl.RunnerException: Unable to execute Sonar
        at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:91)
        at org.sonar.runner.impl.BatchLauncher$1.run(BatchLauncher.java:75)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.BatchLauncher.doExecute(BatchLauncher.java:69)
        at org.sonar.runner.impl.BatchLauncher.execute(BatchLauncher.java:50)
        at org.sonar.runner.api.EmbeddedRunner.doExecute(EmbeddedRunner.java:102)
        at org.sonar.runner.api.Runner.execute(Runner.java:100)
        at org.sonar.runner.Main.executeTask(Main.java:70)
        at org.sonar.runner.Main.execute(Main.java:59)
        at org.sonar.runner.Main.main(Main.java:53)
Caused by: java.lang.NullPointerException
        at io.github.sleroy.sonar.EsLintSensor.execute(EsLintSensor.java:116)
        at org.sonar.batch.sensor.SensorWrapper.analyse(SensorWrapper.java:57)
        at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
        at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
        at org.sonar.batch.phases.AbstractPhaseExecutor.execute(AbstractPhaseExecutor.java:
        at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:1
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.ja
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
        at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:241)
        at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.j
        at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.ja
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
        at org.sonar.batch.task.ScanTask.execute(ScanTask.java:47)
        at org.sonar.batch.task.TaskContainer.doAfterStart(TaskContainer.java:86)
        at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.ja
        at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:127)
        at org.sonar.batch.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:106)
        at org.sonar.batch.bootstrapper.Batch.executeTask(Batch.java:119)
        at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:79)
        at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
        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.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)

@nixel2007
Copy link

nixel2007 commented Jul 28, 2017

@navinprasadk your error is not from the TS plugin.
Please follow to eslint-plugin repo and author

@navinprasadk
Copy link

navinprasadk commented Jul 28, 2017

@nixel2007 I installed eslint for checking .jsx files

version is
sonar-eslint-plugin-0.1.1

Without eslint plugin , Is there any possibilities to check the .jsx files or not?

@nixel2007
Copy link

@navinprasadk this plugin (sonar-typescript-plugin) only analyzes the typescript files.
I don't know if any plugin can analyze jsx (sonar-javascript can't)

@Pablissimo
Copy link
Owner

No support for .jsx, though .tsx is supported in theory (though haven't tried it in so long).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants