sonar-delphi icon indicating copy to clipboard operation
sonar-delphi copied to clipboard

NullPointerException

Open nilleb opened this issue 9 years ago • 5 comments
trafficstars

2016-04-11T10:02:50.7167593Z ##[error]Caused by: java.lang.NullPointerException
2016-04-11T10:02:50.7167593Z ##[error]at org.sonar.plugins.delphi.DelphiSensor.parseFiles(DelphiSensor.java:200)
2016-04-11T10:02:50.7167593Z ##[error]at org.sonar.plugins.delphi.DelphiSensor.analyse(DelphiSensor.java:107)
2016-04-11T10:02:50.7167593Z ##[error]at org.sonar.batch.phases.SensorsExecutor.executeSensor(SensorsExecutor.java:58)
2016-04-11T10:02:50.7167593Z ##[error]at org.sonar.batch.phases.SensorsExecutor.execute(SensorsExecutor.java:50)
2016-04-11T10:02:50.7167593Z ##[error]at org.sonar.batch.phases.PhaseExecutor.execute(PhaseExecutor.java:98)

This is an excerpt of the log of the sonar-runner execution, for a project which doesn't include any Delphi sources. The sonar-runner is being invoked through the TFS vso-agent-task SonarQube Post Test

2016-04-11T10:00:35.8735554Z SonarQube Runner 2.4
2016-04-11T10:00:35.8735554Z Java 1.8.0_45 Oracle Corporation (64-bit)
2016-04-11T10:00:35.8735554Z Windows Server 2012 R2 6.3 amd64
2016-04-11T10:00:35.8735554Z SONAR_RUNNER_OPTS=-Xmx1024m
2016-04-11T10:00:35.8735554Z INFO: Error stacktraces are turned on.
2016-04-11T10:00:35.8735554Z INFO: Runner configuration file: d:\TfsData\_work\6\.sonarqube\bin\sonar-runner\bin\..\conf\sonar-runner.properties
2016-04-11T10:00:35.8735554Z INFO: Project configuration file: d:\TfsData\_work\6\.sonarqube\out\sonar-project.properties
2016-04-11T10:00:35.9828704Z INFO: Default locale: "fr_FR", source code encoding: "UTF-8"
2016-04-11T10:00:35.9828704Z INFO: Work directory: d:\TfsData\_work\6\.sonarqube\out\.sonar
2016-04-11T10:00:36.2040890Z INFO: SonarQube Server 5.3

nilleb avatar Apr 13 '16 11:04 nilleb

I must admit that the dpk/dof/cfg/dpr files being analyzed (in the context above) are not valid ones. These are test files, almost empty. I realize that the problem could just be that the DelphiProject returns a null array when getting the files of a fake (empty) project file.

nilleb avatar Apr 13 '16 11:04 nilleb

Are Delphi 7 projects supported by this plugin ? (dpk/dpr)

nilleb avatar Apr 13 '16 11:04 nilleb

I'm using Delphi XE3, XE7 and Seattle 10 and I'm having hard time with projects files like .dproj.

IDE autogenerated files should not be analysed. Project files may be used only to select which files should be analysed.

.dproj is a XML files with includes, build profiles, platform target profiles, etc, all nodes are duplicated and the plugin is categorizing this nodes as duplicates.

cesarliws avatar Apr 13 '16 11:04 cesarliws

I have no dproj. I just have empty (truncated to 0B) or invalid dpk files in the project being analyzed. These files are test files used by a C# unit test project.

nilleb avatar Apr 13 '16 12:04 nilleb

add this line to your sonar-project.properties sonar.exclusions= *.dpr, *.dpk, *.dproj

SandroLuck avatar Jul 29 '16 08:07 SandroLuck