Skip to content

Commit

Permalink
Loading message template correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasbjerre committed Jul 4, 2018
1 parent 4e2c929 commit 6fef4f0
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,24 @@

Changelog of Violation comments to gitlab lib.

## 1.31
### No issue

**Escaped message and filename**


[3c529460568f513](https://github.com/tomasbjerre/violation-comments-to-gitlab-lib/commit/3c529460568f513) Tomas Bjerre *2018-07-04 10:15:17*


## 1.30
### No issue

**Custom template**


[bff1247b8e5b3c5](https://github.com/tomasbjerre/violation-comments-to-gitlab-lib/commit/bff1247b8e5b3c5) Tomas Bjerre *2018-07-04 08:49:00*


## 1.29
### No issue

Expand Down
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash
./gradlew --refresh-dependencies clean gitChangelogTask eclipse build install -i
./gradlew clean gitChangelogTask eclipse build install -i
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = 1.32-SNAPSHOT
version = 1.33-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
import static se.bjurr.violations.comments.lib.CommentsCreator.createComments;
import static se.bjurr.violations.lib.util.Optional.fromNullable;

import java.net.URI;
import java.nio.charset.Charset;
import java.nio.file.Files;
import java.nio.file.Paths;
import com.github.mustachejava.resolver.DefaultResolver;
import java.io.Reader;
import java.util.List;
import java.util.Scanner;
import java.util.logging.Logger;
import org.gitlab.api.AuthMethod;
import org.gitlab.api.TokenType;
Expand All @@ -24,12 +23,13 @@ public class ViolationCommentsToGitLabApi {

static {
try {
final URI gitlabCommentTemplateUrl =
ViolationCommentsToGitLabApi.class
.getResource(DEFAULT_VIOLATION_TEMPLATE_MUSTACH)
.toURI();
final byte[] bytes = Files.readAllBytes(Paths.get(gitlabCommentTemplateUrl));
DEFAULT_TEMPLATE = new String(bytes, Charset.forName("UTF-8"));
final Reader reader =
new DefaultResolver() //
.getReader(DEFAULT_VIOLATION_TEMPLATE_MUSTACH);
try (Scanner scanner = new Scanner(reader)) {
scanner.useDelimiter("\\A");
DEFAULT_TEMPLATE = scanner.hasNext() ? scanner.next() : "";
}
} catch (final Throwable t) {
Logger.getLogger(ViolationCommentsToGitLabApi.class.getName()).log(SEVERE, t.getMessage(), t);
}
Expand Down

0 comments on commit 6fef4f0

Please sign in to comment.