Skip to content

Commit 61f5325

Browse files
committed
Run reformat code for whole project
1 parent ae8c984 commit 61f5325

40 files changed

+407
-401
lines changed

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
33
<modelVersion>4.0.0</modelVersion>
44
<parent>

src/main/java/com/dabsquared/gitlabjenkins/GitLabProjectBranchesService.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ public class GitLabProjectBranchesService {
2020

2121
private static final Logger LOGGER = Logger.getLogger(GitLabProjectBranchesService.class.getName());
2222

23-
private final Cache<String, List<String>> projectBranchCache;
24-
2523
private static transient GitLabProjectBranchesService gitLabProjectBranchesService;
24+
private final Cache<String, List<String>> projectBranchCache;
2625

2726
GitLabProjectBranchesService() {
2827
this.projectBranchCache = CacheBuilder.<String, String>newBuilder()

src/main/java/com/dabsquared/gitlabjenkins/GitLabPushTrigger.java

+37-37
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,42 @@ public GitLabPushTrigger(boolean triggerOnPush, boolean triggerOnMergeRequest, T
9696
initializeBranchFilter();
9797
}
9898

99+
@Initializer(after = InitMilestone.JOB_LOADED)
100+
public static void migrateJobs() throws IOException {
101+
GitLabPushTrigger.DescriptorImpl oldConfig = Trigger.all().get(GitLabPushTrigger.DescriptorImpl.class);
102+
if (!oldConfig.jobsMigrated) {
103+
GitLabConnectionConfig gitLabConfig = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class);
104+
gitLabConfig.getConnections().add(new GitLabConnection(oldConfig.gitlabHostUrl,
105+
oldConfig.gitlabHostUrl,
106+
oldConfig.gitlabApiToken,
107+
oldConfig.ignoreCertificateErrors));
108+
109+
String defaultConnectionName = gitLabConfig.getConnections().get(0).getName();
110+
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
111+
GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class);
112+
if (trigger != null) {
113+
if (trigger.addCiMessage) {
114+
project.getPublishersList().add(new GitLabCommitStatusPublisher());
115+
}
116+
if (trigger.branchFilterType == null) {
117+
trigger.branchFilterType = trigger.branchFilterName;
118+
}
119+
project.addProperty(new GitLabConnectionProperty(defaultConnectionName));
120+
project.save();
121+
}
122+
}
123+
gitLabConfig.save();
124+
oldConfig.jobsMigrated = true;
125+
oldConfig.save();
126+
}
127+
}
128+
99129
public boolean getTriggerOnPush() {
100-
return triggerOnPush;
130+
return triggerOnPush;
101131
}
102132

103133
public boolean getTriggerOnMergeRequest() {
104-
return triggerOnMergeRequest;
134+
return triggerOnMergeRequest;
105135
}
106136

107137
public TriggerOpenMergeRequest getTriggerOpenMergeRequestOnPush() {
@@ -177,14 +207,14 @@ protected Object readResolve() throws ObjectStreamException {
177207
@Extension
178208
public static class DescriptorImpl extends TriggerDescriptor {
179209

210+
private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Jenkins.MasterComputer.threadPoolForRemoting);
180211
private boolean jobsMigrated = false;
181212
private String gitlabApiToken;
182213
private String gitlabHostUrl = "";
183214
private boolean ignoreCertificateErrors = false;
184-
private transient final SequentialExecutionQueue queue = new SequentialExecutionQueue(Jenkins.MasterComputer.threadPoolForRemoting);
185215

186216
public DescriptorImpl() {
187-
load();
217+
load();
188218
}
189219

190220
@Override
@@ -240,9 +270,9 @@ public boolean configure(StaplerRequest req, JSONObject formData) throws FormExc
240270
}
241271

242272
public ListBoxModel doFillTriggerOpenMergeRequestOnPushItems(@QueryParameter String triggerOpenMergeRequestOnPush) {
243-
return new ListBoxModel(new Option("Never", "never", triggerOpenMergeRequestOnPush.matches("never") ),
244-
new Option("On push to source branch", "source", triggerOpenMergeRequestOnPush.matches("source") ),
245-
new Option("On push to source or target branch", "both", triggerOpenMergeRequestOnPush.matches("both") ));
273+
return new ListBoxModel(new Option("Never", "never", triggerOpenMergeRequestOnPush.matches("never")),
274+
new Option("On push to source branch", "source", triggerOpenMergeRequestOnPush.matches("source")),
275+
new Option("On push to source or target branch", "both", triggerOpenMergeRequestOnPush.matches("both")));
246276
}
247277

248278
public AutoCompletionCandidates doAutoCompleteIncludeBranchesSpec(@AncestorInPath final Job<?, ?> job, @QueryParameter final String value) {
@@ -261,34 +291,4 @@ public FormValidation doCheckExcludeBranchesSpec(@AncestorInPath final Job<?, ?>
261291
return ProjectBranchesProvider.instance().doCheckBranchesSpec(project, value);
262292
}
263293
}
264-
265-
@Initializer(after = InitMilestone.JOB_LOADED)
266-
public static void migrateJobs() throws IOException {
267-
GitLabPushTrigger.DescriptorImpl oldConfig = Trigger.all().get(GitLabPushTrigger.DescriptorImpl.class);
268-
if (!oldConfig.jobsMigrated) {
269-
GitLabConnectionConfig gitLabConfig = (GitLabConnectionConfig) Jenkins.getInstance().getDescriptor(GitLabConnectionConfig.class);
270-
gitLabConfig.getConnections().add(new GitLabConnection(oldConfig.gitlabHostUrl,
271-
oldConfig.gitlabHostUrl,
272-
oldConfig.gitlabApiToken,
273-
oldConfig.ignoreCertificateErrors));
274-
275-
String defaultConnectionName = gitLabConfig.getConnections().get(0).getName();
276-
for (AbstractProject<?, ?> project : Jenkins.getInstance().getAllItems(AbstractProject.class)) {
277-
GitLabPushTrigger trigger = project.getTrigger(GitLabPushTrigger.class);
278-
if (trigger != null) {
279-
if (trigger.addCiMessage) {
280-
project.getPublishersList().add(new GitLabCommitStatusPublisher());
281-
}
282-
if (trigger.branchFilterType == null) {
283-
trigger.branchFilterType = trigger.branchFilterName;
284-
}
285-
project.addProperty(new GitLabConnectionProperty(defaultConnectionName));
286-
project.save();
287-
}
288-
}
289-
gitLabConfig.save();
290-
oldConfig.jobsMigrated = true;
291-
oldConfig.save();
292-
}
293-
}
294294
}

src/main/java/com/dabsquared/gitlabjenkins/cause/CauseData.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import java.util.HashMap;
99
import java.util.Map;
1010

11-
import static com.google.common.base.Preconditions.*;
11+
import static com.google.common.base.Preconditions.checkNotNull;
1212

1313
/**
1414
* @author Robin Müller
@@ -258,7 +258,7 @@ String getShortDescription(CauseData data) {
258258
}, MERGE {
259259
@Override
260260
String getShortDescription(CauseData data) {
261-
return "GitLab Merge Request #" + data.getMergeRequestId()+ " : " + data.getSourceBranch() + " => " + data.getTargetBranch();
261+
return "GitLab Merge Request #" + data.getMergeRequestId() + " : " + data.getSourceBranch() + " => " + data.getTargetBranch();
262262
}
263263
};
264264

src/main/java/com/dabsquared/gitlabjenkins/connection/GitLabConnectionConfig.java

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
import javax.ws.rs.ProcessingException;
1313
import javax.ws.rs.WebApplicationException;
14-
import java.io.IOException;
1514
import java.util.ArrayList;
1615
import java.util.HashMap;
1716
import java.util.List;

src/main/java/com/dabsquared/gitlabjenkins/publisher/GitLabCommitStatusPublisher.java

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import javax.ws.rs.NotFoundException;
2323
import javax.ws.rs.WebApplicationException;
2424
import java.io.IOException;
25-
import java.net.URISyntaxException;
2625
import java.util.ArrayList;
2726
import java.util.List;
2827
import java.util.logging.Level;

src/main/java/com/dabsquared/gitlabjenkins/trigger/branch/AntPathMatcherSet.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
*/
1111
class AntPathMatcherSet extends HashSet<String> {
1212

13+
private transient final AntPathMatcher matcher = new AntPathMatcher();
14+
1315
public AntPathMatcherSet(Collection<? extends String> c) {
1416
super(c);
1517
}
1618

17-
private transient final AntPathMatcher matcher = new AntPathMatcher();
18-
1919
@Override
2020
public boolean contains(Object o) {
2121
for (String s : this) {

src/main/java/com/dabsquared/gitlabjenkins/trigger/branch/ProjectBranchesProvider.java

-5
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,6 @@
55
import com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty;
66
import com.google.common.base.Joiner;
77
import com.google.common.base.Splitter;
8-
import com.google.common.collect.HashMultimap;
9-
import com.google.common.collect.Lists;
10-
import com.google.common.collect.Multimap;
11-
import com.google.common.collect.Sets;
128
import hudson.model.AutoCompletionCandidates;
139
import hudson.model.Item;
1410
import hudson.model.Job;
@@ -23,7 +19,6 @@
2319
import org.kohsuke.stapler.AncestorInPath;
2420
import org.kohsuke.stapler.QueryParameter;
2521

26-
import java.io.IOException;
2722
import java.util.Collections;
2823
import java.util.HashSet;
2924
import java.util.List;

src/main/java/com/dabsquared/gitlabjenkins/trigger/handler/push/OpenMergeRequestPushHookTriggerHandler.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void handle(Job<?, ?> job, PushHook hook, boolean ciSkip, BranchFilter br
4747
if (property != null && property.getClient() != null && projectId != null && trigger != null) {
4848
GitLabApi client = property.getClient();
4949
for (MergeRequest mergeRequest : getOpenMergeRequests(client, projectId.toString())) {
50-
handleMergeRequest(job, hook, ciSkip, branchFilter, client, projectId, mergeRequest);
50+
handleMergeRequest(job, hook, ciSkip, branchFilter, client, projectId, mergeRequest);
5151
}
5252
}
5353
}

src/main/java/com/dabsquared/gitlabjenkins/webhook/ActionResolver.java

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.dabsquared.gitlabjenkins.webhook;
22

33
import com.dabsquared.gitlabjenkins.util.ACLUtil;
4-
import com.dabsquared.gitlabjenkins.util.LoggerUtil;
54
import com.dabsquared.gitlabjenkins.webhook.build.MergeRequestBuildAction;
65
import com.dabsquared.gitlabjenkins.webhook.build.PushBuildAction;
76
import com.dabsquared.gitlabjenkins.webhook.status.BranchBuildPageRedirectAction;

src/main/java/com/dabsquared/gitlabjenkins/webhook/GitLabWebHook.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,16 @@
1515
import java.util.logging.Logger;
1616

1717
/**
18-
*
1918
* @author Daniel Brooks
2019
*/
2120

2221
@Extension
2322
public class GitLabWebHook implements UnprotectedRootAction {
2423

25-
private static final Logger LOGGER = Logger.getLogger(GitLabWebHook.class.getName());
26-
2724
public static final String WEBHOOK_URL = "project";
2825

26+
private static final Logger LOGGER = Logger.getLogger(GitLabWebHook.class.getName());
27+
2928
private transient final ActionResolver actionResolver = new ActionResolver();
3029

3130
public String getIconFileName() {

src/main/java/com/dabsquared/gitlabjenkins/webhook/status/BuildPageRedirectAction.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package com.dabsquared.gitlabjenkins.webhook.status;
22

33
import com.dabsquared.gitlabjenkins.webhook.WebHookAction;
4-
import hudson.model.AbstractBuild;
5-
import hudson.model.Job;
64
import hudson.model.Run;
75
import hudson.util.HttpResponses;
86
import jenkins.model.Jenkins;
@@ -22,7 +20,7 @@ protected BuildPageRedirectAction(Run<?, ?> build) {
2220
}
2321

2422
public void execute(StaplerResponse response) {
25-
if(build != null) {
23+
if (build != null) {
2624
try {
2725
response.sendRedirect2(Jenkins.getInstance().getRootUrl() + build.getUrl());
2826
} catch (IOException e) {

src/main/java/com/dabsquared/gitlabjenkins/webhook/status/BuildStatusAction.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ public void execute(StaplerResponse response) {
3434
protected abstract void writeStatusBody(StaplerResponse response, Run<?, ?> build, BuildStatus status);
3535

3636
private boolean hasGitSCM(SCMTriggerItem item) {
37-
if(item != null) {
38-
for(SCM scm : item.getSCMs()) {
39-
if(scm instanceof GitSCM) {
37+
if (item != null) {
38+
for (SCM scm : item.getSCMs()) {
39+
if (scm instanceof GitSCM) {
4040
return true;
4141
}
4242
}

src/main/java/com/dabsquared/gitlabjenkins/webhook/status/CommitBuildPageRedirectAction.java

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package com.dabsquared.gitlabjenkins.webhook.status;
22

33
import com.dabsquared.gitlabjenkins.util.BuildUtil;
4-
import hudson.model.AbstractProject;
54
import hudson.model.Job;
65

76
/**

src/main/java/com/dabsquared/gitlabjenkins/webhook/status/StatusPngAction.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ protected StatusPngAction(Job<?, ?> project, Run<?, ?> build) {
1919
@Override
2020
protected void writeStatusBody(StaplerResponse response, Run<?, ?> build, BuildStatus status) {
2121
try {
22-
response.setHeader("Expires","Fri, 01 Jan 1984 00:00:00 GMT");
22+
response.setHeader("Expires", "Fri, 01 Jan 1984 00:00:00 GMT");
2323
response.setHeader("Cache-Control", "no-cache, private");
2424
response.setHeader("Content-Type", "image/png");
2525
IOUtils.copy(getStatusImage(status), response.getOutputStream());

src/main/resources/com/dabsquared/gitlabjenkins/GitLabPushTrigger/GitLabWebHookPollingAction/index.jelly

+5-5
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2222
THE SOFTWARE.
2323
-->
2424
<?jelly escape-by-default='true'?>
25-
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
25+
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:l="/lib/layout">
2626
<l:layout>
27-
<st:include it="${it.owner}" page="sidepanel.jelly" />
27+
<st:include it="${it.owner}" page="sidepanel.jelly"/>
2828
<l:main-panel>
2929
<h1>${%Last GitLab Push}</h1>
30-
<j:set var="log" value="${it.log}" />
30+
<j:set var="log" value="${it.log}"/>
3131
<j:choose>
3232
<j:when test="${empty(log)}">
3333
${%Polling has not run yet.}
3434
</j:when>
3535
<j:otherwise>
3636
<pre>
37-
<st:getOutput var="output" />
37+
<st:getOutput var="output"/>
3838
<j:whitespace>${it.writeLogTo(output)}</j:whitespace>
3939
</pre>
4040
</j:otherwise>
4141
</j:choose>
4242
</l:main-panel>
4343
</l:layout>
44-
</j:jelly>
44+
</j:jelly>

0 commit comments

Comments
 (0)