Skip to content

Commit

Permalink
Fixed "rule does not exist" crash on Objective-C sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilles Grousset committed Oct 23, 2018
1 parent fc7400d commit 17c8613
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}


}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());
}


}
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<groupId>com.backelite.sonarqube</groupId>
<artifactId>backelite-swift</artifactId>
<version>0.4.1</version>
<version>0.4.2</version>

<packaging>pom</packaging>

Expand Down

0 comments on commit 17c8613

Please sign in to comment.