Skip to content

Commit

Permalink
Fix NullPointerException #80
Browse files Browse the repository at this point in the history
Handle file not found condition - skipping violation was not handle
correctly
  • Loading branch information
Bertk committed Dec 18, 2013
1 parent 53fc223 commit 9c6a633
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,16 +166,18 @@ protected void saveViolation(Project project, SensorContext context, String rule
CxxUtils.LOG.warn("Skipping invalid line number: {}", line);
}
}
// file level violation
violation.setMessage(msg);
context.saveViolation(violation);
} else {
CxxUtils.LOG.warn("Cannot find the file '{}', skipping violation '{}'", file, msg);
}
} else {
// project level violation
violation = Violation.create(rule, project);
violation.setMessage(msg);
context.saveViolation(violation);
}

violation.setMessage(msg);
context.saveViolation(violation);
} else {
CxxUtils.LOG.warn("Cannot find the rule {}, skipping violation", ruleId);
}
Expand Down

0 comments on commit 9c6a633

Please sign in to comment.