diff --git a/CHANGELOG.md b/CHANGELOG.md index 28feb4c8..85352c7d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # _SonarQube Plugin for Swift_ Changelog +## v0.4.2 +- Fixed "rule does not exist" crash on Objective-C sensors ## v0.4.1 - Fixed NPE on SquidSensor diff --git a/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/fauxpas/FauxPasReportParser.java b/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/fauxpas/FauxPasReportParser.java index bbcbed31..430631df 100644 --- a/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/fauxpas/FauxPasReportParser.java +++ b/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/fauxpas/FauxPasReportParser.java @@ -102,7 +102,12 @@ private void recordIssue(final JSONObject diagnosticJson) { .message(info) .build(); - issuable.addIssue(issue); + try { + issuable.addIssue(issue); + } catch (Exception e) { + // Unable to add issue : probably because does not exist in the repository + LOGGER.warn(e.getMessage()); + } } diff --git a/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/oclint/OCLintXMLStreamHandler.java b/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/oclint/OCLintXMLStreamHandler.java index ec55c7c6..592501f8 100644 --- a/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/oclint/OCLintXMLStreamHandler.java +++ b/objclang/src/main/java/com/backelite/sonarqube/objectivec/issues/oclint/OCLintXMLStreamHandler.java @@ -19,6 +19,7 @@ import org.codehaus.staxmate.in.SMHierarchicCursor; import org.codehaus.staxmate.in.SMInputCursor; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; @@ -32,6 +33,7 @@ import java.io.File; final class OCLintXMLStreamHandler implements XmlStreamHandler { + private static final Logger LOGGER = LoggerFactory.getLogger(OCLintXMLStreamHandler.class); private static final int PMD_MINIMUM_PRIORITY = 5; private final ResourcePerspectives resourcePerspectives; private final FileSystem fileSystem; @@ -88,7 +90,12 @@ private void recordViolation(InputFile inputFile, final SMInputCursor line) thro .message(line.getElemStringValue()) .build(); - issuable.addIssue(issue); + try { + issuable.addIssue(issue); + } catch (Exception e) { + // Unable to add issue : probably because does not exist in the repository + LOGGER.warn(e.getMessage()); + } } diff --git a/pom.xml b/pom.xml index 9af943b1..e7ba5200 100644 --- a/pom.xml +++ b/pom.xml @@ -39,7 +39,7 @@ com.backelite.sonarqube backelite-swift - 0.4.1 + 0.4.2 pom