|
1 | 1 | package se.bjurr.violations.comments.bitbucketserver.lib; |
2 | 2 |
|
3 | | -import static com.google.common.base.Throwables.propagate; |
4 | 3 | import static com.google.common.collect.Lists.newArrayList; |
5 | 4 |
|
6 | 5 | import java.util.ArrayList; |
7 | 6 | import java.util.List; |
8 | 7 |
|
| 8 | +import org.slf4j.Logger; |
| 9 | +import org.slf4j.LoggerFactory; |
| 10 | + |
9 | 11 | import se.bjurr.violations.comments.bitbucketserver.lib.client.BitbucketServerClient; |
10 | 12 | import se.bjurr.violations.comments.bitbucketserver.lib.client.BitbucketServerComment; |
11 | 13 | import se.bjurr.violations.comments.lib.model.ChangedFile; |
|
14 | 16 |
|
15 | 17 | public class BitbucketServerCommentsProvider implements CommentsProvider { |
16 | 18 |
|
| 19 | + private static final Logger LOG = LoggerFactory.getLogger(BitbucketServerCommentsProvider.class); |
| 20 | + |
17 | 21 | private final BitbucketServerClient client; |
18 | 22 |
|
19 | 23 | private final ViolationCommentsToBitbucketServerApi violationCommentsToBitbucketApi; |
@@ -78,12 +82,14 @@ public List<ChangedFile> getFiles() { |
78 | 82 | @Override |
79 | 83 | public void removeComments(List<Comment> comments) { |
80 | 84 | for (Comment comment : comments) { |
| 85 | + Integer commentId = null; |
| 86 | + Integer commentVersion = null; |
81 | 87 | try { |
82 | | - Integer commentId = Integer.valueOf(comment.getIdentifier()); |
83 | | - Integer commentVersion = Integer.valueOf(comment.getSpecifics().get(0)); |
| 88 | + commentId = Integer.valueOf(comment.getIdentifier()); |
| 89 | + commentVersion = Integer.valueOf(comment.getSpecifics().get(0)); |
84 | 90 | this.client.pullRequestRemoveComment(commentId, commentVersion); |
85 | 91 | } catch (Exception e) { |
86 | | - throw propagate(e); |
| 92 | + LOG.warn("Was unable to remove comment " + commentId + " " + commentVersion, e); |
87 | 93 | } |
88 | 94 | } |
89 | 95 | } |
|
0 commit comments