From 47847d60b906d48829252a592d68eb0e853f4e3d Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Thu, 15 Jan 2015 15:28:36 +0100 Subject: [PATCH] Fix Null Pointer when cobertura path property is missing --- .../org/sonar/plugins/scala/cobertura/CoberturaSensor.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/sonar/plugins/scala/cobertura/CoberturaSensor.java b/src/main/java/org/sonar/plugins/scala/cobertura/CoberturaSensor.java index cf3da99..9621bc7 100644 --- a/src/main/java/org/sonar/plugins/scala/cobertura/CoberturaSensor.java +++ b/src/main/java/org/sonar/plugins/scala/cobertura/CoberturaSensor.java @@ -59,7 +59,11 @@ public boolean shouldExecuteOnProject(Project project) { } public void analyse(Project project, SensorContext context) { - String path = settings.getString(COBERTURA_REPORTS_PATH_PROPERTY); + String path = settings.getString(COBERTURA_REPORTS_PATH_PROPERTY); + if (path == null){ + LOG.warn("Cobertura report path property \"sonar.cobertura.reportPath\" not found!"); + return; + } File report = pathResolver.relativeFile(fileSystem.baseDir(), path); if (!report.isFile()) { LOG.warn("Cobertura report not found at {}", report);