Skip to content

Commit

Permalink
java-gitlab-api is throwing Error
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Sep 2, 2017
1 parent 3d58620 commit 47f9761
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 1.12
### No issue

**Optionally set title to WIP on violations**


[f8043a49e21c174](https://github.com/tomasbjerre/violation-comments-to-gitlab-lib/commit/f8043a49e21c1747326b8cc8b0a71394b48fa268) Tomas Bjerre *2017-09-02 09:55:07*


## 1.11
### No issue

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import static se.bjurr.violations.comments.lib.PatchParser.findLineToComment;
import static se.bjurr.violations.comments.lib.utils.CommentsUtils.escapeHTML;

import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import org.gitlab.api.AuthMethod;
import org.gitlab.api.GitlabAPI;
import org.gitlab.api.TokenType;
Expand All @@ -17,6 +17,7 @@
import org.gitlab.api.models.GitlabProject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import se.bjurr.violations.comments.lib.model.ChangedFile;
import se.bjurr.violations.comments.lib.model.Comment;
import se.bjurr.violations.comments.lib.model.CommentsProvider;
Expand Down Expand Up @@ -48,14 +49,14 @@ public GitLabCommentsProvider(ViolationCommentsToGitLabApi violationCommentsToGi
final String projectId = violationCommentsToGitLabApi.getProjectId();
try {
project = gitlabApi.getProject(projectId);
} catch (final IOException e) {
} catch (final Throwable e) {
throw new RuntimeException("Could not get project " + projectId);
}

final Integer mergeRequestId = violationCommentsToGitLabApi.getMergeRequestId();
try {
mergeRequest = gitlabApi.getMergeRequestChanges(project.getId(), mergeRequestId);
} catch (final IOException e) {
} catch (final Throwable e) {
throw new RuntimeException("Could not get MR " + projectId + " " + mergeRequestId, e);
}

Expand All @@ -67,7 +68,7 @@ public void createCommentWithAllSingleFileComments(String comment) {
addingComment();
try {
gitlabApi.createNote(mergeRequest, comment);
} catch (final IOException e) {
} catch (final Throwable e) {
LOG.error("Could create comment " + comment, e);
}
}
Expand Down Expand Up @@ -97,7 +98,7 @@ private void addingComment() {
description,
stateEvent,
labels);
} catch (final IOException e) {
} catch (final Throwable e) {
LOG.error(e.getMessage(), e);
}
}
Expand All @@ -113,7 +114,7 @@ public void createSingleFileComment(ChangedFile file, Integer line, String comme
final String line_type = "new";
try {
gitlabApi.createCommitComment(projectId, sha, note, path, line + "", line_type);
} catch (final IOException e) {
} catch (final Throwable e) {
LOG.error(
"Could not create commit comment"
+ projectId
Expand Down Expand Up @@ -141,7 +142,7 @@ public List<Comment> getComments() {
final Comment comment = new Comment(identifier, content, type, specifics);
found.add(comment);
}
} catch (final IOException e) {
} catch (final Throwable e) {
LOG.error("Could not get comments", e);
}
return found;
Expand Down Expand Up @@ -169,7 +170,7 @@ public void removeComments(List<Comment> comments) {
final GitlabNote noteToDelete = new GitlabNote();
noteToDelete.setId(Integer.parseInt(comment.getIdentifier()));
gitlabApi.deleteNote(mergeRequest, noteToDelete);
} catch (final IOException e) {
} catch (final Throwable e) {
LOG.error("Could not delete note " + comment);
}
}
Expand Down

0 comments on commit 47f9761

Please sign in to comment.