Skip to content

Commit 171fad6

Browse files
committed
Mark as thread safe #21
1 parent 6545219 commit 171fad6

File tree

1 file changed

+79
-79
lines changed

1 file changed

+79
-79
lines changed

src/main/java/se/bjurr/gitchangelog/plugin/GitChangelogMojo.java

+79-79
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import org.apache.maven.plugins.annotations.Parameter;
1515
import se.bjurr.gitchangelog.api.GitChangelogApi;
1616

17-
@Mojo(name = "git-changelog", defaultPhase = PROCESS_SOURCES)
17+
@Mojo(name = "git-changelog", defaultPhase = PROCESS_SOURCES, threadSafe = true)
1818
public class GitChangelogMojo extends AbstractMojo {
1919
private static final String DEFAULT_FILE = "CHANGELOG.md";
2020

@@ -131,142 +131,142 @@ public class GitChangelogMojo extends AbstractMojo {
131131

132132
@Override
133133
public void execute() throws MojoExecutionException {
134-
if (skip != null && skip == true) {
135-
getLog().info("Skipping changelog generation");
134+
if (this.skip != null && this.skip == true) {
135+
this.getLog().info("Skipping changelog generation");
136136
return;
137137
}
138138
try {
139139
GitChangelogApi builder;
140140
builder = gitChangelogApiBuilder();
141-
if (isSupplied(settingsFile)) {
142-
builder.withSettings(new File(settingsFile).toURI().toURL());
141+
if (this.isSupplied(this.settingsFile)) {
142+
builder.withSettings(new File(this.settingsFile).toURI().toURL());
143143
}
144144

145-
if (isSupplied(extendedVariables)) {
146-
builder.withExtendedVariables(extendedVariables);
145+
if (this.isSupplied(this.extendedVariables)) {
146+
builder.withExtendedVariables(this.extendedVariables);
147147
}
148148

149-
if (isSupplied(toRef)) {
150-
builder.withToRef(toRef);
149+
if (this.isSupplied(this.toRef)) {
150+
builder.withToRef(this.toRef);
151151
}
152152

153-
if (isSupplied(templateFile)) {
154-
builder.withTemplatePath(templateFile);
153+
if (this.isSupplied(this.templateFile)) {
154+
builder.withTemplatePath(this.templateFile);
155155
}
156-
if (isSupplied(templateContent)) {
157-
builder.withTemplateContent(templateContent);
156+
if (this.isSupplied(this.templateContent)) {
157+
builder.withTemplateContent(this.templateContent);
158158
}
159-
if (isSupplied(fromCommit)) {
160-
builder.withFromCommit(fromCommit);
159+
if (this.isSupplied(this.fromCommit)) {
160+
builder.withFromCommit(this.fromCommit);
161161
}
162-
if (isSupplied(fromRef)) {
163-
builder.withFromRef(fromRef);
162+
if (this.isSupplied(this.fromRef)) {
163+
builder.withFromRef(this.fromRef);
164164
}
165-
if (isSupplied(toCommit)) {
166-
builder.withToCommit(toCommit);
165+
if (this.isSupplied(this.toCommit)) {
166+
builder.withToCommit(this.toCommit);
167167
}
168168

169-
if (isSupplied(ignoreTagsIfNameMatches)) {
170-
builder.withIgnoreTagsIfNameMatches(ignoreTagsIfNameMatches);
169+
if (this.isSupplied(this.ignoreTagsIfNameMatches)) {
170+
builder.withIgnoreTagsIfNameMatches(this.ignoreTagsIfNameMatches);
171171
}
172-
if (isSupplied(readableTagName)) {
173-
builder.withReadableTagName(readableTagName);
172+
if (this.isSupplied(this.readableTagName)) {
173+
builder.withReadableTagName(this.readableTagName);
174174
}
175-
if (isSupplied(dateFormat)) {
176-
builder.withDateFormat(dateFormat);
175+
if (this.isSupplied(this.dateFormat)) {
176+
builder.withDateFormat(this.dateFormat);
177177
}
178-
if (isSupplied(timeZone)) {
179-
builder.withTimeZone(timeZone);
178+
if (this.isSupplied(this.timeZone)) {
179+
builder.withTimeZone(this.timeZone);
180180
}
181-
builder.withRemoveIssueFromMessageArgument(removeIssueFromMessage);
182-
if (isSupplied(ignoreCommitsIfMessageMatches)) {
183-
builder.withIgnoreCommitsWithMessage(ignoreCommitsIfMessageMatches);
181+
builder.withRemoveIssueFromMessageArgument(this.removeIssueFromMessage);
182+
if (this.isSupplied(this.ignoreCommitsIfMessageMatches)) {
183+
builder.withIgnoreCommitsWithMessage(this.ignoreCommitsIfMessageMatches);
184184
}
185-
if (ignoreCommitsOlderThan != null) {
186-
builder.withIgnoreCommitsOlderThan(ignoreCommitsOlderThan);
185+
if (this.ignoreCommitsOlderThan != null) {
186+
builder.withIgnoreCommitsOlderThan(this.ignoreCommitsOlderThan);
187187
}
188-
if (isSupplied(untaggedName)) {
189-
builder.withUntaggedName(untaggedName);
188+
if (this.isSupplied(this.untaggedName)) {
189+
builder.withUntaggedName(this.untaggedName);
190190
}
191-
if (isSupplied(noIssueName)) {
192-
builder.withNoIssueName(noIssueName);
191+
if (this.isSupplied(this.noIssueName)) {
192+
builder.withNoIssueName(this.noIssueName);
193193
}
194-
if (ignoreCommitsWithoutIssue != null) {
195-
builder.withIgnoreCommitsWithoutIssue(ignoreCommitsWithoutIssue);
194+
if (this.ignoreCommitsWithoutIssue != null) {
195+
builder.withIgnoreCommitsWithoutIssue(this.ignoreCommitsWithoutIssue);
196196
}
197-
for (final CustomIssue customIssue : customIssues) {
197+
for (final CustomIssue customIssue : this.customIssues) {
198198
builder.withCustomIssue(
199199
customIssue.getName(),
200200
customIssue.getPattern(),
201201
customIssue.getLink(),
202202
customIssue.getTitle());
203203
}
204-
if (isSupplied(gitHubApi)) {
205-
builder.withGitHubApi(gitHubApi);
204+
if (this.isSupplied(this.gitHubApi)) {
205+
builder.withGitHubApi(this.gitHubApi);
206206
}
207-
if (isSupplied(gitHubToken)) {
208-
builder.withGitHubToken(gitHubToken);
207+
if (this.isSupplied(this.gitHubToken)) {
208+
builder.withGitHubToken(this.gitHubToken);
209209
}
210-
if (isSupplied(gitHubIssuePattern)) {
211-
builder.withGitHubIssuePattern(gitHubIssuePattern);
210+
if (this.isSupplied(this.gitHubIssuePattern)) {
211+
builder.withGitHubIssuePattern(this.gitHubIssuePattern);
212212
}
213213

214-
if (isSupplied(gitLabProjectName)) {
215-
builder.withGitLabProjectName(gitLabProjectName);
214+
if (this.isSupplied(this.gitLabProjectName)) {
215+
builder.withGitLabProjectName(this.gitLabProjectName);
216216
}
217-
if (isSupplied(gitLabServer)) {
218-
builder.withGitLabServer(gitLabServer);
217+
if (this.isSupplied(this.gitLabServer)) {
218+
builder.withGitLabServer(this.gitLabServer);
219219
}
220-
if (isSupplied(gitLabToken)) {
221-
builder.withGitLabToken(gitLabToken);
220+
if (this.isSupplied(this.gitLabToken)) {
221+
builder.withGitLabToken(this.gitLabToken);
222222
}
223223

224-
if (isSupplied(jiraUsername)) {
225-
builder.withJiraUsername(jiraUsername);
224+
if (this.isSupplied(this.jiraUsername)) {
225+
builder.withJiraUsername(this.jiraUsername);
226226
}
227-
if (isSupplied(jiraPassword)) {
228-
builder.withJiraPassword(jiraPassword);
227+
if (this.isSupplied(this.jiraPassword)) {
228+
builder.withJiraPassword(this.jiraPassword);
229229
}
230-
if (isSupplied(jiraIssuePattern)) {
231-
builder.withJiraIssuePattern(jiraIssuePattern);
230+
if (this.isSupplied(this.jiraIssuePattern)) {
231+
builder.withJiraIssuePattern(this.jiraIssuePattern);
232232
}
233-
if (isSupplied(jiraServer)) {
234-
builder.withJiraServer(jiraServer);
233+
if (this.isSupplied(this.jiraServer)) {
234+
builder.withJiraServer(this.jiraServer);
235235
}
236236

237-
if (isSupplied(pathFilter)) {
238-
builder.withPathFilter(pathFilter);
237+
if (this.isSupplied(this.pathFilter)) {
238+
builder.withPathFilter(this.pathFilter);
239239
}
240240

241-
if (file == null && !isSupplied(mediaWikiUrl)) {
242-
getLog().info("No output set, using file " + DEFAULT_FILE);
243-
file = new File(DEFAULT_FILE);
241+
if (this.file == null && !this.isSupplied(this.mediaWikiUrl)) {
242+
this.getLog().info("No output set, using file " + DEFAULT_FILE);
243+
this.file = new File(DEFAULT_FILE);
244244
}
245245

246-
if (file != null) {
247-
builder.toFile(file);
248-
getLog().info("#");
249-
getLog().info("# Wrote: " + file);
250-
getLog().info("#");
246+
if (this.file != null) {
247+
builder.toFile(this.file);
248+
this.getLog().info("#");
249+
this.getLog().info("# Wrote: " + this.file);
250+
this.getLog().info("#");
251251
}
252252

253-
if (isSupplied(mediaWikiUrl)) {
253+
if (this.isSupplied(this.mediaWikiUrl)) {
254254
builder //
255255
.toMediaWiki( //
256-
mediaWikiUsername, //
257-
mediaWikiPassword, //
258-
mediaWikiUrl, //
259-
mediaWikiTitle);
260-
getLog().info("#");
261-
getLog().info("# Created: " + mediaWikiUrl + "/index.php/" + mediaWikiTitle);
262-
getLog().info("#");
256+
this.mediaWikiUsername, //
257+
this.mediaWikiPassword, //
258+
this.mediaWikiUrl, //
259+
this.mediaWikiTitle);
260+
this.getLog().info("#");
261+
this.getLog().info("# Created: " + this.mediaWikiUrl + "/index.php/" + this.mediaWikiTitle);
262+
this.getLog().info("#");
263263
}
264264
} catch (final Exception e) {
265-
getLog().error("GitChangelog", e);
265+
this.getLog().error("GitChangelog", e);
266266
}
267267
}
268268

269-
private boolean isSupplied(String parameter) {
269+
private boolean isSupplied(final String parameter) {
270270
return !isNullOrEmpty(parameter);
271271
}
272272

0 commit comments

Comments
 (0)