octo-technology / sonar-objective-c

Sonar Plugin for Objective C
517 stars 206 forks source link

java.lang.NullPointerException during execute sonar-runner #83

Open optimusbits opened 9 years ago

optimusbits commented 9 years ago

We have installed SonarQube on centos x64. On the other machine is installed sonar client to run with iOS application projects.

Each time, we run ./sonar-runner -X we got exception:

12:41:34.674 INFO  - Sensor Objective-C SurefireSensor...
12:41:34.686 DEBUG - Release semaphore on project : 

org.sonar.api.resources.Project@7708b79d[id=17840,key=MyProject,qualifier=TRK], with key batch-MyProject
12:41:34.874 DEBUG - To prevent a memory leak, the JDBC Driver [org.postgresql.Driver] has been forcibly deregistered
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
Total time: 9:16.712s
Final Memory: 12M/261M
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 java.io.File.<init>(File.java:277)
    at org.sonar.plugins.objectivec_dca.tests.SurefireSensor.analyse(SurefireSensor.java:65)
    at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:72)
    at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:114)
    at org.sonar.batch.scan.ModuleScanContainer.doAfterStart(ModuleScanContainer.java:150)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ProjectScanContainer.scan(ProjectScanContainer.java:211)
    at org.sonar.batch.scan.ProjectScanContainer.scanRecursively(ProjectScanContainer.java:206)
    at org.sonar.batch.scan.ProjectScanContainer.doAfterStart(ProjectScanContainer.java:199)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.scan.ScanTask.scan(ScanTask.java:58)
    at org.sonar.batch.scan.ScanTask.execute(ScanTask.java:45)
    at org.sonar.batch.bootstrap.TaskContainer.doAfterStart(TaskContainer.java:82)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrap.BootstrapContainer.executeTask(BootstrapContainer.java:144)
    at org.sonar.batch.bootstrap.BootstrapContainer.doAfterStart(BootstrapContainer.java:132)
    at org.sonar.api.platform.ComponentContainer.startComponents(ComponentContainer.java:92)
    at org.sonar.api.platform.ComponentContainer.execute(ComponentContainer.java:77)
    at org.sonar.batch.bootstrapper.Batch.startBatch(Batch.java:92)
    at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:74)
    at org.sonar.runner.batch.IsolatedLauncher.execute(IsolatedLauncher.java:48)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.sonar.runner.impl.BatchLauncher$1.delegateExecution(BatchLauncher.java:87)
    ... 9 more

before that is a lot of lines ofØ

12:34:58.609 DEBUG - Updating semaphore batch-MyProject
12:35:08.785 DEBUG - Updating semaphore batch-MyProject
12:35:18.966 DEBUG - Updating semaphore batch-MyProject
12:35:29.143 DEBUG - Updating semaphore batch-MyProject
12:35:39.322 DEBUG - Updating semaphore batch-MyProject
12:35:49.500 DEBUG - Updating semaphore batch-MyProject
12:35:59.946 DEBUG - Updating semaphore batch-MyProject
12:36:10.123 DEBUG - Updating semaphore batch-MyProject
12:36:20.300 DEBUG - Updating semaphore batch-MyProject
12:36:30.486 DEBUG - Updating semaphore batch-MyProject
12:36:40.666 DEBUG - Updating semaphore batch-MyProject
12:36:50.859 DEBUG - Updating semaphore batch-MyProject
12:37:01.041 DEBUG - Updating semaphore batch-MyProject
12:37:11.223 DEBUG - Updating semaphore batch-MyProject
12:37:21.403 DEBUG - Updating semaphore batch-MyProject

and

18:57:52.681 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 220, column 48
18:57:52.685 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 1363, column 17
18:57:52.685 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 1364, column 17
18:57:52.685 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 1365, column 17
18:57:52.685 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 1366, column 17
18:57:52.685 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 1367, column 17
18:57:52.685 DEBUG - None of the channel has been able to handle character '/' (decimal value 47) at line 1368, column 17

Running sonar-runner generate sonar-reports folder with files coverage-MyProject.xml, oclint.xml, TEST-report.xml

This happens on:

Server:

SonarQube Server - 4.1.2 os - centos x64 Sonar plugin objectiveC - 0.4 Sonra plugin surefire - 3.3.2

Client

os. OSX 10.10.2 x86_64, MacMini SonarQube Runner 2.4 Java 1.7.0_45 Oracle Corporation (64-bit)

I found similar problem https://github.com/octo-technology/sonar-objective-c/issues/50 but without specific solutions

sonar-project.properties:

##########################
# Required configuration #
##########################

sonar.projectKey= MyProject
sonar.projectName= MyProject
sonar.projectVersion=1.0
sonar.language=objc

# Project description
sonar.projectDescription= MyProject trunk

# Path to source directories 
sonar.sources=./MyProject

# Xcode project configuration (.xcodeproj or .xcworkspace)
# -> If you have a project: configure only sonar.objectivec.project
# -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project
# and use the later to specify which project(s) to include in the analysis (comma separated list)
sonar.objectivec.project= MyProject.xcodeproj

# Scheme to build your application
sonar.objectivec.appScheme= MyProject
# Scheme to build and run your tests (comment following line of you don't have any tests)
sonar.objectivec.testScheme= MyProject Tests

##########################
# Optional configuration #
##########################

# Encoding of the source code
sonar.sourceEncoding=UTF-8

# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml
# Change it only if you generate the file on your own
# The XML files have to be prefixed by TEST- otherwise they are not processed 
# sonar.junit.reportsPath=sonar-reports/

# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml
# Change it only if you generate the file on your own
sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml

# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml
# Change it only if you generate the file on your own
sonar.objectivec.oclint.report=sonar-reports/oclint.xml

# Paths to exclude from coverage report (tests, 3rd party libraries etc.)
# sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2
sonar.objectivec.excludedPathsFromCoverage=ExternalLibraries*
#,*ExternalLibraries*,*Images,*Customers

########################
# Sonar db
########################
sonar.jdbc.url=jdbc:postgresql://sql04.valid-host.com/sonar
sonar.jdbc.driverClassName=org.postgresql.Driver
sonar.jdbc.validationQuery=select 1
sonar.jdbc.user=valid-user
sonar.jdbc.password=valid-password
sonar.web.host=http://valid-host.com
haynzz commented 7 years ago

I have a similar problem with the swift plugin. But it only appears when I have a failing test. Do you also have a failing test?