diff --git a/checkstyle-sonar-plugin/config/suppressions.xml b/checkstyle-sonar-plugin/config/suppressions.xml index 87201d36..08bd24f6 100644 --- a/checkstyle-sonar-plugin/config/suppressions.xml +++ b/checkstyle-sonar-plugin/config/suppressions.xml @@ -26,7 +26,7 @@ - + diff --git a/checkstyle-sonar-plugin/pom.xml b/checkstyle-sonar-plugin/pom.xml index 5596cd5a..2fb897e1 100644 --- a/checkstyle-sonar-plugin/pom.xml +++ b/checkstyle-sonar-plugin/pom.xml @@ -293,7 +293,7 @@ org.sonar.plugins.checkstyle.CheckstyleAuditListener 71 - 85 + 84 org.sonar.plugins.checkstyle.CheckstyleConfiguration diff --git a/checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java b/checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java index 1ec156c6..2845f7e3 100644 --- a/checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java +++ b/checkstyle-sonar-plugin/src/main/java/org/sonar/plugins/checkstyle/CheckstyleAuditListener.java @@ -133,15 +133,17 @@ static String getMessage(AuditEvent event) { @VisibleForTesting static Integer getLineId(AuditEvent event) { + Integer result = null; try { int line = event.getLine(); // checkstyle returns 0 if there is no relation to a file content, but we use null - return line == 0 ? null : line; - + if (line != 0) { + result = line; + } } catch (Exception e) { // checkstyle can throw a NullPointerException if the message is not set - return null; } + return result; } /**