aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2011-11-14 00:35:13 +0100
committersimonbrandhof <simon.brandhof@gmail.com>2011-11-14 00:52:33 +0100
commitb795969e86cba9fa57116b4da5944ee130e73019 (patch)
tree306fbcc4c17f754bbf966ac71db5ec9a0b37a847
parent684796a2f44196d15ed92da9a3ecee2c905c1516 (diff)
downloadsonarqube-b795969e86cba9fa57116b4da5944ee130e73019.tar.gz
sonarqube-b795969e86cba9fa57116b4da5944ee130e73019.zip
Fix potential NPE in Gradle task
-rw-r--r--sonar-batch/src/main/java/org/sonar/batch/Batch.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/Batch.java b/sonar-batch/src/main/java/org/sonar/batch/Batch.java
index d10b89398f9..ef964b991ac 100644
--- a/sonar-batch/src/main/java/org/sonar/batch/Batch.java
+++ b/sonar-batch/src/main/java/org/sonar/batch/Batch.java
@@ -65,11 +65,14 @@ public final class Batch {
/**
* Used by Gradle 1.0
- * @deprecated
+ *
+ * @deprecated
*/
@Deprecated
public static Batch create(ProjectReactor projectReactor, Configuration configuration, Object... bootstrapperComponents) {
- projectReactor.getRoot().setProperties(convertToProperties(configuration));
+ if (configuration != null) {
+ projectReactor.getRoot().setProperties(convertToProperties(configuration));
+ }
return new Batch(projectReactor, bootstrapperComponents);
}
@@ -77,7 +80,7 @@ public final class Batch {
Properties props = new Properties();
Iterator keys = configuration.getKeys();
while (keys.hasNext()) {
- String key = (String)keys.next();
+ String key = (String) keys.next();
// Configuration#getString() automatically splits strings by comma separator.
String value = StringUtils.join(configuration.getStringArray(key), ",");
props.setProperty(key, value);