diff options
author | Godin <mandrikov@gmail.com> | 2010-10-17 01:46:18 +0000 |
---|---|---|
committer | Godin <mandrikov@gmail.com> | 2010-10-17 01:46:18 +0000 |
commit | 2d070c7e49c6ef519bfb9ef67c67d25c7563a6c0 (patch) | |
tree | 75dde51f05d3301239361d3b88c4682c337a991f | |
parent | ef8460a7546aa7183c12c40b73b0b6c329aa9aea (diff) | |
download | sonarqube-2d070c7e49c6ef519bfb9ef67c67d25c7563a6c0.tar.gz sonarqube-2d070c7e49c6ef519bfb9ef67c67d25c7563a6c0.zip |
SONAR-1847: Meaningful exception should be thrown when saving violation with a rule that doesn't exist
-rw-r--r-- | sonar-batch/src/main/java/org/sonar/batch/ViolationsDao.java | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sonar-batch/src/main/java/org/sonar/batch/ViolationsDao.java b/sonar-batch/src/main/java/org/sonar/batch/ViolationsDao.java index 304105442f1..00bc5e1cd7a 100644 --- a/sonar-batch/src/main/java/org/sonar/batch/ViolationsDao.java +++ b/sonar-batch/src/main/java/org/sonar/batch/ViolationsDao.java @@ -63,7 +63,7 @@ public class ViolationsDao { } public void saveViolation(Snapshot snapshot, Violation violation) { - if (profile == null || snapshot == null || violation == null) { + if (profile == null || snapshot == null || violation == null || violation.getRule() == null) { throw new IllegalArgumentException("Missing data to save violation : profile=" + profile + ",snapshot=" + snapshot + ",violation=" + violation); } @@ -74,7 +74,7 @@ public class ViolationsDao { } else { LoggerFactory.getLogger(getClass()).debug("Violation is not saved because rule is not activated : violation={}", violation); } - } + } if (activeRule != null) { RuleFailureModel model = toModel(snapshot, violation, activeRule); session.save(model); |