diff options
author | Godin <mandrikov@gmail.com> | 2010-10-20 11:46:26 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-10-20 11:46:26 +0000 |
commit | c311147fa8c0c0cd827ed8db1d7b0115067472ad (patch) | |
tree | 8c2fb6383a7295d1f12f9fa22b6cf99ddf82f995 /plugins/sonar-cobertura-plugin/src | |
parent | 71fba38c4f5cfe22803b3a253e07772a76d9219e (diff) | |
download | sonarqube-c311147fa8c0c0cd827ed8db1d7b0115067472ad.tar.gz sonarqube-c311147fa8c0c0cd827ed8db1d7b0115067472ad.zip |
SONAR-1808: Fix possible NPE
Diffstat (limited to 'plugins/sonar-cobertura-plugin/src')
-rw-r--r-- | plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/AbstractCoberturaParser.java | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/AbstractCoberturaParser.java b/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/AbstractCoberturaParser.java index 109bb353da1..4a4acb20b9c 100644 --- a/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/AbstractCoberturaParser.java +++ b/plugins/sonar-cobertura-plugin/src/main/java/org/sonar/plugins/cobertura/api/AbstractCoberturaParser.java @@ -86,8 +86,9 @@ public abstract class AbstractCoberturaParser { String lineId = line.getAttrValue("number"); data.addLine(lineId, (int) parseNumber(line.getAttrValue("hits"), ENGLISH)); + String isBranch = line.getAttrValue("branch"); String text = line.getAttrValue("condition-coverage"); - if (StringUtils.isNotBlank(text)) { + if (StringUtils.equals(isBranch, "true") && StringUtils.isNotBlank(text)) { String[] conditions = StringUtils.split(StringUtils.substringBetween(text, "(", ")"), "/"); data.addConditionLine(lineId, Integer.parseInt(conditions[0]), Integer.parseInt(conditions[1]), StringUtils.substringBefore(text, " ")); } |