diff --git a/pom.xml b/pom.xml
index e3eeb736b..7b3feb66a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -175,6 +175,9 @@
${formatter-maven-plugin.goal}
+
+ src/main/resources/eclipse/formatter.xml
+
diff --git a/src/main/java/org/kohsuke/github/GHApp.java b/src/main/java/org/kohsuke/github/GHApp.java
index 6c587ce08..a7fb74fee 100644
--- a/src/main/java/org/kohsuke/github/GHApp.java
+++ b/src/main/java/org/kohsuke/github/GHApp.java
@@ -183,8 +183,9 @@ public class GHApp extends GHObject {
@Preview
@Deprecated
public PagedIterable listInstallations() {
- return root.retrieve().withPreview(MACHINE_MAN).asPagedIterable("/app/installations", GHAppInstallation[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .withPreview(MACHINE_MAN)
+ .asPagedIterable("/app/installations", GHAppInstallation[].class, item -> item.wrapUp(root));
}
/**
@@ -202,8 +203,10 @@ public class GHApp extends GHObject {
@Preview
@Deprecated
public GHAppInstallation getInstallationById(long id) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN)
- .to(String.format("/app/installations/%d", id), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve()
+ .withPreview(MACHINE_MAN)
+ .to(String.format("/app/installations/%d", id), GHAppInstallation.class)
+ .wrapUp(root);
}
/**
@@ -222,8 +225,10 @@ public class GHApp extends GHObject {
@Preview
@Deprecated
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN)
- .to(String.format("/orgs/%s/installation", name), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve()
+ .withPreview(MACHINE_MAN)
+ .to(String.format("/orgs/%s/installation", name), GHAppInstallation.class)
+ .wrapUp(root);
}
/**
@@ -244,7 +249,8 @@ public class GHApp extends GHObject {
@Preview
@Deprecated
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN)
+ return root.retrieve()
+ .withPreview(MACHINE_MAN)
.to(String.format("/repos/%s/%s/installation", ownerName, repositoryName), GHAppInstallation.class)
.wrapUp(root);
}
@@ -264,8 +270,10 @@ public class GHApp extends GHObject {
@Preview
@Deprecated
public GHAppInstallation getInstallationByUser(String name) throws IOException {
- return root.retrieve().withPreview(MACHINE_MAN)
- .to(String.format("/users/%s/installation", name), GHAppInstallation.class).wrapUp(root);
+ return root.retrieve()
+ .withPreview(MACHINE_MAN)
+ .to(String.format("/users/%s/installation", name), GHAppInstallation.class)
+ .wrapUp(root);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java b/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
index 4570cae5b..43291820b 100644
--- a/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
@@ -1,6 +1,7 @@
package org.kohsuke.github;
import java.io.IOException;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -23,7 +24,7 @@ public class GHAppCreateTokenBuilder {
this.root = root;
this.apiUrlTail = apiUrlTail;
this.builder = new Requester(root);
- this.builder.withPermissions("permissions", permissions);
+ withPermissions(builder, permissions);
}
/**
@@ -58,4 +59,12 @@ public class GHAppCreateTokenBuilder {
.wrapUp(root);
}
+ private static Requester withPermissions(Requester builder, Map value) {
+ Map retMap = new HashMap();
+ for (Map.Entry entry : value.entrySet()) {
+ retMap.put(entry.getKey(), Requester.transformEnum(entry.getValue()));
+ }
+ return builder.with("permissions", retMap);
+ }
+
}
diff --git a/src/main/java/org/kohsuke/github/GHAsset.java b/src/main/java/org/kohsuke/github/GHAsset.java
index cd7001d25..0003c9703 100644
--- a/src/main/java/org/kohsuke/github/GHAsset.java
+++ b/src/main/java/org/kohsuke/github/GHAsset.java
@@ -135,7 +135,7 @@ public class GHAsset extends GHObject {
}
private void edit(String key, Object value) throws IOException {
- new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
+ new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHAuthorization.java b/src/main/java/org/kohsuke/github/GHAuthorization.java
index 1cc469c98..26b5f3d51 100644
--- a/src/main/java/org/kohsuke/github/GHAuthorization.java
+++ b/src/main/java/org/kohsuke/github/GHAuthorization.java
@@ -158,8 +158,8 @@ public class GHAuthorization extends GHObject {
return this;
}
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
- "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
+ justification = "JSON API")
private static class App {
private String url;
private String name;
diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java
index c6b0cc1fd..5c210fe0e 100644
--- a/src/main/java/org/kohsuke/github/GHBranch.java
+++ b/src/main/java/org/kohsuke/github/GHBranch.java
@@ -16,8 +16,10 @@ import static org.kohsuke.github.Previews.*;
*
* @author Yusuke Kokubo
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "URF_UNREAD_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" },
+ justification = "JSON API")
public class GHBranch {
private GitHub root;
private GHRepository owner;
@@ -149,13 +151,15 @@ public class GHBranch {
@Deprecated
public void enableProtection(EnforcementLevel level, Collection contexts) throws IOException {
switch (level) {
- case OFF:
- disableProtection();
- break;
- case NON_ADMINS:
- case EVERYONE:
- enableProtection().addRequiredChecks(contexts).includeAdmins(level == EnforcementLevel.EVERYONE).enable();
- break;
+ case OFF :
+ disableProtection();
+ break;
+ case NON_ADMINS :
+ case EVERYONE :
+ enableProtection().addRequiredChecks(contexts)
+ .includeAdmins(level == EnforcementLevel.EVERYONE)
+ .enable();
+ break;
}
}
diff --git a/src/main/java/org/kohsuke/github/GHBranchProtection.java b/src/main/java/org/kohsuke/github/GHBranchProtection.java
index e9b8b1861..80a5e7bb4 100644
--- a/src/main/java/org/kohsuke/github/GHBranchProtection.java
+++ b/src/main/java/org/kohsuke/github/GHBranchProtection.java
@@ -11,8 +11,10 @@ import java.util.Collection;
/**
* The type GHBranchProtection.
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "URF_UNREAD_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" },
+ justification = "JSON API")
public class GHBranchProtection {
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";
diff --git a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
index 33db4aa93..c94020b30 100644
--- a/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java
@@ -19,8 +19,10 @@ import static org.kohsuke.github.Previews.*;
*
* @see GHBranch#enableProtection() GHBranch#enableProtection()
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "URF_UNREAD_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" },
+ justification = "JSON API")
public class GHBranchProtectionBuilder {
private final GHBranch branch;
@@ -86,10 +88,13 @@ public class GHBranchProtectionBuilder {
* the io exception
*/
public GHBranchProtection enable() throws IOException {
- return requester().method("PUT").withNullable("required_status_checks", statusChecks)
- .withNullable("required_pull_request_reviews", prReviews).withNullable("restrictions", restrictions)
+ return requester().method("PUT")
+ .withNullable("required_status_checks", statusChecks)
+ .withNullable("required_pull_request_reviews", prReviews)
+ .withNullable("restrictions", restrictions)
.withNullable("enforce_admins", enforceAdmins)
- .to(branch.getProtectionUrl().toString(), GHBranchProtection.class).wrap(branch);
+ .to(branch.getProtectionUrl().toString(), GHBranchProtection.class)
+ .wrap(branch);
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java
index 5f381bfc9..b1e7b7dc0 100644
--- a/src/main/java/org/kohsuke/github/GHCommit.java
+++ b/src/main/java/org/kohsuke/github/GHCommit.java
@@ -27,8 +27,10 @@ public class GHCommit {
/**
* Short summary of this commit.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "UWF_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public static class ShortInfo {
private GHAuthor author;
private GHAuthor committer;
@@ -167,7 +169,8 @@ public class GHCommit {
*
* @return Full path in the repository.
*/
- @SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library's API and cannot be renamed")
+ @SuppressFBWarnings(value = "NM_CONFUSING",
+ justification = "It's a part of the library's API and cannot be renamed")
public String getFileName() {
return filename;
}
@@ -344,7 +347,7 @@ public class GHCommit {
*/
public List getFiles() throws IOException {
populate();
- return files != null ? Collections.unmodifiableList(files) : Collections. emptyList();
+ return files != null ? Collections.unmodifiableList(files) : Collections.emptyList();
}
/**
@@ -438,9 +441,11 @@ public class GHCommit {
* @return {@link PagedIterable} with all the commit comments in this repository.
*/
public PagedIterable listComments() {
- return owner.root.retrieve().asPagedIterable(
- String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
- GHCommitComment[].class, item -> item.wrap(owner));
+ return owner.root.retrieve()
+ .asPagedIterable(
+ String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
+ GHCommitComment[].class,
+ item -> item.wrap(owner));
}
/**
@@ -461,7 +466,9 @@ public class GHCommit {
* if comment is not created
*/
public GHCommitComment createComment(String body, String path, Integer line, Integer position) throws IOException {
- GHCommitComment r = new Requester(owner.root).with("body", body).with("path", path).with("line", line)
+ GHCommitComment r = new Requester(owner.root).with("body", body)
+ .with("path", path)
+ .with("line", line)
.with("position", position)
.to(String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
GHCommitComment.class);
diff --git a/src/main/java/org/kohsuke/github/GHCommitBuilder.java b/src/main/java/org/kohsuke/github/GHCommitBuilder.java
index 0b8c0fff2..71335ee02 100644
--- a/src/main/java/org/kohsuke/github/GHCommitBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHCommitBuilder.java
@@ -85,7 +85,7 @@ public class GHCommitBuilder {
* @return the gh commit builder
*/
public GHCommitBuilder author(String name, String email, Date date) {
- req._with("author", new UserInfo(name, email, date));
+ req.with("author", new UserInfo(name, email, date));
return this;
}
@@ -101,7 +101,7 @@ public class GHCommitBuilder {
* @return the gh commit builder
*/
public GHCommitBuilder committer(String name, String email, Date date) {
- req._with("committer", new UserInfo(name, email, date));
+ req.with("committer", new UserInfo(name, email, date));
return this;
}
@@ -117,7 +117,7 @@ public class GHCommitBuilder {
* the io exception
*/
public GHCommit create() throws IOException {
- req._with("parents", parents);
+ req.with("parents", parents);
return req.method("POST").to(getApiTail(), GHCommit.class).wrapUp(repo);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHCommitComment.java b/src/main/java/org/kohsuke/github/GHCommitComment.java
index 9ee1843a7..e53e8607f 100644
--- a/src/main/java/org/kohsuke/github/GHCommitComment.java
+++ b/src/main/java/org/kohsuke/github/GHCommitComment.java
@@ -16,8 +16,8 @@ import static org.kohsuke.github.Previews.*;
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
* Integer)
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GHCommitComment extends GHObject implements Reactable {
private GHRepository owner;
@@ -120,15 +120,18 @@ public class GHCommitComment extends GHObject implements Reactable {
@Preview
@Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
- .to(getApiTail() + "/reactions", GHReaction.class).wrap(owner.root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL)
+ .with("content", content.getContent())
+ .to(getApiTail() + "/reactions", GHReaction.class)
+ .wrap(owner.root);
}
@Preview
@Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiTail() + "/reactions",
- GHReaction[].class, item -> item.wrap(owner.root));
+ return owner.root.retrieve()
+ .withPreview(SQUIRREL_GIRL)
+ .asPagedIterable(getApiTail() + "/reactions", GHReaction[].class, item -> item.wrap(owner.root));
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHCompare.java b/src/main/java/org/kohsuke/github/GHCompare.java
index d01cb6734..430e9fc46 100644
--- a/src/main/java/org/kohsuke/github/GHCompare.java
+++ b/src/main/java/org/kohsuke/github/GHCompare.java
@@ -163,8 +163,8 @@ public class GHCompare {
* Compare commits had a child commit element with additional details we want to capture. This extenstion of
* GHCommit provides that.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD",
- "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public static class Commit extends GHCommit {
private InnerCommit commit;
diff --git a/src/main/java/org/kohsuke/github/GHContent.java b/src/main/java/org/kohsuke/github/GHContent.java
index 41429b6d2..86f5a4aad 100644
--- a/src/main/java/org/kohsuke/github/GHContent.java
+++ b/src/main/java/org/kohsuke/github/GHContent.java
@@ -306,8 +306,11 @@ public class GHContent implements Refreshable {
throws IOException {
String encodedContent = Base64.encodeBase64String(newContentBytes);
- Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
- .with("content", encodedContent).method("PUT");
+ Requester requester = new Requester(root).with("path", path)
+ .with("message", commitMessage)
+ .with("sha", sha)
+ .with("content", encodedContent)
+ .method("PUT");
if (branch != null) {
requester.with("branch", branch);
@@ -347,7 +350,9 @@ public class GHContent implements Refreshable {
* the io exception
*/
public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException {
- Requester requester = new Requester(root).with("path", path).with("message", commitMessage).with("sha", sha)
+ Requester requester = new Requester(root).with("path", path)
+ .with("message", commitMessage)
+ .with("sha", sha)
.method("DELETE");
if (branch != null) {
diff --git a/src/main/java/org/kohsuke/github/GHEmail.java b/src/main/java/org/kohsuke/github/GHEmail.java
index 796aa3aae..e1b892f00 100644
--- a/src/main/java/org/kohsuke/github/GHEmail.java
+++ b/src/main/java/org/kohsuke/github/GHEmail.java
@@ -30,8 +30,10 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
*
* @author Kelly Campbell
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" },
+ justification = "JSON API")
public class GHEmail {
protected String email;
diff --git a/src/main/java/org/kohsuke/github/GHEventInfo.java b/src/main/java/org/kohsuke/github/GHEventInfo.java
index 830ab3f80..de150e282 100644
--- a/src/main/java/org/kohsuke/github/GHEventInfo.java
+++ b/src/main/java/org/kohsuke/github/GHEventInfo.java
@@ -30,8 +30,10 @@ public class GHEventInfo {
/**
* Inside the event JSON model, GitHub uses a slightly different format.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
+ justification = "JSON API")
public static class GHEventRepository {
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
private long id;
@@ -86,8 +88,8 @@ public class GHEventInfo {
* @throws IOException
* on error
*/
- @SuppressFBWarnings(value = {
- "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "The field comes from JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
+ justification = "The field comes from JSON deserialization")
public GHRepository getRepository() throws IOException {
return root.getRepository(repo.name);
}
@@ -99,8 +101,8 @@ public class GHEventInfo {
* @throws IOException
* on error
*/
- @SuppressFBWarnings(value = {
- "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "The field comes from JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
+ justification = "The field comes from JSON deserialization")
public GHUser getActor() throws IOException {
return root.getUser(actor.getLogin());
}
@@ -123,8 +125,8 @@ public class GHEventInfo {
* @throws IOException
* the io exception
*/
- @SuppressFBWarnings(value = {
- "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "The field comes from JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
+ justification = "The field comes from JSON deserialization")
public GHOrganization getOrganization() throws IOException {
return (org == null || org.getLogin() == null) ? null : root.getOrganization(org.getLogin());
}
diff --git a/src/main/java/org/kohsuke/github/GHEventPayload.java b/src/main/java/org/kohsuke/github/GHEventPayload.java
index 4806f5626..ddf0b17e1 100644
--- a/src/main/java/org/kohsuke/github/GHEventPayload.java
+++ b/src/main/java/org/kohsuke/github/GHEventPayload.java
@@ -53,8 +53,9 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public static class PullRequest extends GHEventPayload {
private String action;
private int number;
@@ -251,8 +252,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Issue extends GHEventPayload {
private String action;
private GHIssue issue;
@@ -323,8 +324,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class IssueComment extends GHEventPayload {
private String action;
private GHIssueComment comment;
@@ -416,8 +417,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class CommitComment extends GHEventPayload {
private String action;
private GHCommitComment comment;
@@ -486,8 +487,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Create extends GHEventPayload {
private String ref;
@JsonProperty("ref_type")
@@ -570,8 +571,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Delete extends GHEventPayload {
private String ref;
@JsonProperty("ref_type")
@@ -631,8 +632,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Deployment extends GHEventPayload {
private GHDeployment deployment;
private GHRepository repository;
@@ -691,8 +692,8 @@ public abstract class GHEventPayload {
* @see authoritative
* source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class DeploymentStatus extends GHEventPayload {
@JsonProperty("deployment_status")
private GHDeploymentStatus deploymentStatus;
@@ -772,8 +773,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Fork extends GHEventPayload {
private GHRepository forkee;
private GHRepository repository;
@@ -924,8 +925,9 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD",
- "UUF_UNUSED_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(
+ value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD", "UUF_UNUSED_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Push extends GHEventPayload {
private String head, before;
private boolean created, deleted, forced;
@@ -1196,8 +1198,8 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR",
- "NP_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Release extends GHEventPayload {
private String action;
private GHRelease release;
@@ -1265,8 +1267,9 @@ public abstract class GHEventPayload {
*
* @see authoritative source
*/
- @SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD",
- "UWF_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
+ @SuppressFBWarnings(
+ value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR", "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD" },
+ justification = "Constructed by JSON deserialization")
public static class Repository extends GHEventPayload {
private String action;
private GHRepository repository;
diff --git a/src/main/java/org/kohsuke/github/GHGistBuilder.java b/src/main/java/org/kohsuke/github/GHGistBuilder.java
index 5b2fbb9cb..b0d572038 100644
--- a/src/main/java/org/kohsuke/github/GHGistBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHGistBuilder.java
@@ -72,7 +72,7 @@ public class GHGistBuilder {
* if Gist cannot be created.
*/
public GHGist create() throws IOException {
- req._with("files", files);
+ req.with("files", files);
return req.to("/gists", GHGist.class).wrapUp(root);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHGistUpdater.java b/src/main/java/org/kohsuke/github/GHGistUpdater.java
index fd9db2a65..af5a4876a 100644
--- a/src/main/java/org/kohsuke/github/GHGistUpdater.java
+++ b/src/main/java/org/kohsuke/github/GHGistUpdater.java
@@ -95,7 +95,7 @@ public class GHGistUpdater {
* the io exception
*/
public GHGist update() throws IOException {
- builder._with("files", files);
+ builder.with("files", files);
return builder.method("PATCH").to(base.getApiTailUrl(""), GHGist.class).wrap(base.owner);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHHook.java b/src/main/java/org/kohsuke/github/GHHook.java
index 4b56fb1c4..a88c9a372 100644
--- a/src/main/java/org/kohsuke/github/GHHook.java
+++ b/src/main/java/org/kohsuke/github/GHHook.java
@@ -15,8 +15,8 @@ import java.util.Map;
*
* @author Kohsuke Kawaguchi
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public abstract class GHHook extends GHObject {
String name;
List events;
diff --git a/src/main/java/org/kohsuke/github/GHHooks.java b/src/main/java/org/kohsuke/github/GHHooks.java
index 2d2d9af48..7f99de7a7 100644
--- a/src/main/java/org/kohsuke/github/GHHooks.java
+++ b/src/main/java/org/kohsuke/github/GHHooks.java
@@ -74,8 +74,11 @@ class GHHooks {
ea.add(e.symbol());
}
- GHHook hook = new Requester(root).with("name", name).with("active", active)._with("config", config)
- ._with("events", ea).to(collection(), clazz());
+ GHHook hook = new Requester(root).with("name", name)
+ .with("active", active)
+ .with("config", config)
+ .with("events", ea)
+ .to(collection(), clazz());
return wrap(hook);
}
diff --git a/src/main/java/org/kohsuke/github/GHInvitation.java b/src/main/java/org/kohsuke/github/GHInvitation.java
index c28c7419b..530889841 100644
--- a/src/main/java/org/kohsuke/github/GHInvitation.java
+++ b/src/main/java/org/kohsuke/github/GHInvitation.java
@@ -11,8 +11,10 @@ import java.net.URL;
* @see GitHub#getMyInvitations() GitHub#getMyInvitations()
* @see GHRepository#listInvitations() GHRepository#listInvitations()
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "UUF_UNUSED_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "UUF_UNUSED_FIELD" },
+ justification = "JSON API")
public class GHInvitation extends GHObject {
/* package almost final */ GitHub root;
diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java
index c5eddbdc2..71a95639e 100644
--- a/src/main/java/org/kohsuke/github/GHIssue.java
+++ b/src/main/java/org/kohsuke/github/GHIssue.java
@@ -237,11 +237,11 @@ public class GHIssue extends GHObject implements Reactable {
}
private void edit(String key, Object value) throws IOException {
- new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
+ new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
}
private void editIssue(String key, Object value) throws IOException {
- new Requester(root)._with(key, value).method("PATCH").to(getIssuesApiRoute());
+ new Requester(root).with(key, value).method("PATCH").to(getIssuesApiRoute());
}
/**
@@ -482,7 +482,8 @@ public class GHIssue extends GHObject implements Reactable {
* the io exception
*/
public void addAssignees(Collection assignees) throws IOException {
- root.retrieve().method("POST").withLogins(ASSIGNEES, assignees).to(getIssuesApiRoute() + "/assignees", this);
+ root.retrieve().method("POST").with(ASSIGNEES, getLogins(assignees)).to(getIssuesApiRoute() + "/assignees",
+ this);
}
/**
@@ -506,7 +507,7 @@ public class GHIssue extends GHObject implements Reactable {
* the io exception
*/
public void setAssignees(Collection assignees) throws IOException {
- new Requester(root).withLogins(ASSIGNEES, assignees).method("PATCH").to(getIssuesApiRoute());
+ new Requester(root).with(ASSIGNEES, getLogins(assignees)).method("PATCH").to(getIssuesApiRoute());
}
/**
@@ -530,7 +531,7 @@ public class GHIssue extends GHObject implements Reactable {
* the io exception
*/
public void removeAssignees(Collection assignees) throws IOException {
- root.retrieve().method("DELETE").withLogins(ASSIGNEES, assignees).inBody()
+ root.retrieve().method("DELETE").with(ASSIGNEES, getLogins(assignees)).inBody()
.to(getIssuesApiRoute() + "/assignees", this);
}
@@ -677,6 +678,14 @@ public class GHIssue extends GHObject implements Reactable {
}
}
+ protected static List getLogins(Collection users) {
+ List names = new ArrayList(users.size());
+ for (GHUser a : users) {
+ names.add(a.getLogin());
+ }
+ return names;
+ }
+
/**
* Lists events for this issue. See https://developer.github.com/v3/issues/events/
*
diff --git a/src/main/java/org/kohsuke/github/GHIssueBuilder.java b/src/main/java/org/kohsuke/github/GHIssueBuilder.java
index 7475d77a1..766449596 100644
--- a/src/main/java/org/kohsuke/github/GHIssueBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHIssueBuilder.java
@@ -93,7 +93,9 @@ public class GHIssueBuilder {
* the io exception
*/
public GHIssue create() throws IOException {
- return builder.with("labels", labels).with("assignees", assignees)
- .to(repo.getApiTailUrl("issues"), GHIssue.class).wrap(repo);
+ return builder.with("labels", labels)
+ .with("assignees", assignees)
+ .to(repo.getApiTailUrl("issues"), GHIssue.class)
+ .wrap(repo);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHIssueComment.java b/src/main/java/org/kohsuke/github/GHIssueComment.java
index d04164b84..9c2f1ae58 100644
--- a/src/main/java/org/kohsuke/github/GHIssueComment.java
+++ b/src/main/java/org/kohsuke/github/GHIssueComment.java
@@ -125,15 +125,18 @@ public class GHIssueComment extends GHObject implements Reactable {
@Preview
@Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
- .to(getApiRoute() + "/reactions", GHReaction.class).wrap(owner.root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL)
+ .with("content", content.getContent())
+ .to(getApiRoute() + "/reactions", GHReaction.class)
+ .wrap(owner.root);
}
@Preview
@Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
- GHReaction[].class, item -> item.wrap(owner.root));
+ return owner.root.retrieve()
+ .withPreview(SQUIRREL_GIRL)
+ .asPagedIterable(getApiRoute() + "/reactions", GHReaction[].class, item -> item.wrap(owner.root));
}
private String getApiRoute() {
diff --git a/src/main/java/org/kohsuke/github/GHIssueEvent.java b/src/main/java/org/kohsuke/github/GHIssueEvent.java
index f74ce20ea..83c220404 100644
--- a/src/main/java/org/kohsuke/github/GHIssueEvent.java
+++ b/src/main/java/org/kohsuke/github/GHIssueEvent.java
@@ -124,7 +124,10 @@ public class GHIssueEvent {
@Override
public String toString() {
- return String.format("Issue %d was %s by %s on %s", getIssue().getNumber(), getEvent(), getActor().getLogin(),
+ return String.format("Issue %d was %s by %s on %s",
+ getIssue().getNumber(),
+ getEvent(),
+ getActor().getLogin(),
getCreatedAt().toString());
}
}
diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java
index 608902cec..7c6bc38a8 100644
--- a/src/main/java/org/kohsuke/github/GHLabel.java
+++ b/src/main/java/org/kohsuke/github/GHLabel.java
@@ -81,8 +81,13 @@ public class GHLabel {
* the io exception
*/
public void setColor(String newColor) throws IOException {
- repo.root.retrieve().method("PATCH").withPreview(SYMMETRA).with("name", name).with("color", newColor)
- .with("description", description).to(url);
+ repo.root.retrieve()
+ .method("PATCH")
+ .withPreview(SYMMETRA)
+ .with("name", name)
+ .with("color", newColor)
+ .with("description", description)
+ .to(url);
}
/**
@@ -96,8 +101,13 @@ public class GHLabel {
@Preview
@Deprecated
public void setDescription(String newDescription) throws IOException {
- repo.root.retrieve().method("PATCH").withPreview(SYMMETRA).with("name", name).with("color", color)
- .with("description", newDescription).to(url);
+ repo.root.retrieve()
+ .method("PATCH")
+ .withPreview(SYMMETRA)
+ .with("name", name)
+ .with("color", color)
+ .with("description", newDescription)
+ .to(url);
}
static Collection toNames(Collection labels) {
diff --git a/src/main/java/org/kohsuke/github/GHLicense.java b/src/main/java/org/kohsuke/github/GHLicense.java
index e05a934b2..e7c4cff56 100644
--- a/src/main/java/org/kohsuke/github/GHLicense.java
+++ b/src/main/java/org/kohsuke/github/GHLicense.java
@@ -41,8 +41,8 @@ import java.util.List;
* @see https://developer.github.com/v3/licenses/
*/
@SuppressWarnings({ "UnusedDeclaration" })
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GHLicense extends GHObject {
@SuppressFBWarnings("IS2_INCONSISTENT_SYNC")
// root is set before the object is returned to the app
diff --git a/src/main/java/org/kohsuke/github/GHMilestone.java b/src/main/java/org/kohsuke/github/GHMilestone.java
index fe127fbf2..2126869cb 100644
--- a/src/main/java/org/kohsuke/github/GHMilestone.java
+++ b/src/main/java/org/kohsuke/github/GHMilestone.java
@@ -159,7 +159,7 @@ public class GHMilestone extends GHObject {
}
private void edit(String key, Object value) throws IOException {
- new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
+ new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHMyself.java b/src/main/java/org/kohsuke/github/GHMyself.java
index d728d7ed8..0d16f77d4 100644
--- a/src/main/java/org/kohsuke/github/GHMyself.java
+++ b/src/main/java/org/kohsuke/github/GHMyself.java
@@ -175,8 +175,10 @@ public class GHMyself extends GHUser {
* @return the paged iterable
*/
public PagedIterable listRepositories(final int pageSize, final RepositoryListFilter repoType) {
- return root.retrieve().with("type", repoType)
- .asPagedIterable("/user/repos", GHRepository[].class, item -> item.wrap(root)).withPageSize(pageSize);
+ return root.retrieve()
+ .with("type", repoType)
+ .asPagedIterable("/user/repos", GHRepository[].class, item -> item.wrap(root))
+ .withPageSize(pageSize);
}
/**
@@ -206,8 +208,9 @@ public class GHMyself extends GHUser {
* @return the paged iterable
*/
public PagedIterable listOrgMemberships(final GHMembership.State state) {
- return root.retrieve().with("state", state).asPagedIterable("/user/memberships/orgs", GHMembership[].class,
- item -> item.wrap(root));
+ return root.retrieve()
+ .with("state", state)
+ .asPagedIterable("/user/memberships/orgs", GHMembership[].class, item -> item.wrap(root));
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHNotificationStream.java b/src/main/java/org/kohsuke/github/GHNotificationStream.java
index 71dd0a3de..9d6248065 100644
--- a/src/main/java/org/kohsuke/github/GHNotificationStream.java
+++ b/src/main/java/org/kohsuke/github/GHNotificationStream.java
@@ -101,7 +101,9 @@ public class GHNotificationStream implements Iterable {
*/
public Iterator iterator() {
// capture the configuration setting here
- final Requester req = new Requester(root).method("GET").with("all", all).with("participating", participating)
+ final Requester req = new Requester(root).method("GET")
+ .with("all", all)
+ .with("participating", participating)
.with("since", since);
return new Iterator() {
diff --git a/src/main/java/org/kohsuke/github/GHObject.java b/src/main/java/org/kohsuke/github/GHObject.java
index 8c657ea69..a2893c2e1 100644
--- a/src/main/java/org/kohsuke/github/GHObject.java
+++ b/src/main/java/org/kohsuke/github/GHObject.java
@@ -16,8 +16,8 @@ import java.util.Map;
/**
* Most (all?) domain objects in GitHub seems to have these 4 properties.
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public abstract class GHObject {
/**
* Capture response HTTP headers on the state object.
diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java
index 3ed363d3e..c7edefdb4 100644
--- a/src/main/java/org/kohsuke/github/GHOrganization.java
+++ b/src/main/java/org/kohsuke/github/GHOrganization.java
@@ -39,7 +39,10 @@ public class GHOrganization extends GHPerson {
* the io exception
* @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
*/
- public GHRepository createRepository(String name, String description, String homepage, String team,
+ public GHRepository createRepository(String name,
+ String description,
+ String homepage,
+ String team,
boolean isPublic) throws IOException {
GHTeam t = getTeams().get(team);
if (t == null)
@@ -65,11 +68,17 @@ public class GHOrganization extends GHPerson {
* the io exception
* @deprecated Use {@link #createRepository(String)} that uses a builder pattern to let you control every aspect.
*/
- public GHRepository createRepository(String name, String description, String homepage, GHTeam team,
+ public GHRepository createRepository(String name,
+ String description,
+ String homepage,
+ GHTeam team,
boolean isPublic) throws IOException {
if (team == null)
throw new IllegalArgumentException("Invalid team");
- return createRepository(name).description(description).homepage(homepage).private_(!isPublic).team(team)
+ return createRepository(name).description(description)
+ .homepage(homepage)
+ .private_(!isPublic)
+ .team(team)
.create();
}
@@ -111,8 +120,10 @@ public class GHOrganization extends GHPerson {
* the io exception
*/
public PagedIterable listTeams() throws IOException {
- return root.retrieve().asPagedIterable(String.format("/orgs/%s/teams", login), GHTeam[].class,
- item -> item.wrapUp(GHOrganization.this));
+ return root.retrieve()
+ .asPagedIterable(String.format("/orgs/%s/teams", login),
+ GHTeam[].class,
+ item -> item.wrapUp(GHOrganization.this));
}
/**
@@ -171,7 +182,9 @@ public class GHOrganization extends GHPerson {
* "https://developer.github.com/v3/orgs/members/#add-or-update-organization-membership">documentation
*/
public void add(GHUser user, Role role) throws IOException {
- root.retrieve().method("PUT").with("role", role.name().toLowerCase())
+ root.retrieve()
+ .method("PUT")
+ .with("role", role.name().toLowerCase())
.to("/orgs/" + login + "/memberships/" + user.getLogin());
}
@@ -285,8 +298,10 @@ public class GHOrganization extends GHPerson {
private PagedIterable listMembers(final String suffix, final String filter) throws IOException {
String filterParams = (filter == null) ? "" : ("?filter=" + filter);
- return root.retrieve().asPagedIterable(String.format("/orgs/%s/%s%s", login, suffix, filterParams),
- GHUser[].class, item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(String.format("/orgs/%s/%s%s", login, suffix, filterParams),
+ GHUser[].class,
+ item -> item.wrapUp(root));
}
/**
@@ -311,7 +326,9 @@ public class GHOrganization extends GHPerson {
* the io exception
*/
public PagedIterable listProjects(final GHProject.ProjectStateFilter status) throws IOException {
- return root.retrieve().withPreview(INERTIA).with("state", status)
+ return root.retrieve()
+ .withPreview(INERTIA)
+ .with("state", status)
.asPagedIterable(String.format("/orgs/%s/projects", login), GHProject[].class, item -> item.wrap(root));
}
@@ -338,8 +355,13 @@ public class GHOrganization extends GHPerson {
* the io exception
*/
public GHProject createProject(String name, String body) throws IOException {
- return root.retrieve().method("POST").withPreview(INERTIA).with("name", name).with("body", body)
- .to(String.format("/orgs/%s/projects", login), GHProject.class).wrap(root);
+ return root.retrieve()
+ .method("POST")
+ .withPreview(INERTIA)
+ .with("name", name)
+ .with("body", body)
+ .to(String.format("/orgs/%s/projects", login), GHProject.class)
+ .wrap(root);
}
/**
@@ -430,8 +452,10 @@ public class GHOrganization extends GHPerson {
* Lists events performed by a user (this includes private events if the caller is authenticated.
*/
public PagedIterable listEvents() throws IOException {
- return root.retrieve().asPagedIterable(String.format("/orgs/%s/events", login), GHEventInfo[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(String.format("/orgs/%s/events", login),
+ GHEventInfo[].class,
+ item -> item.wrapUp(root));
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHPerson.java b/src/main/java/org/kohsuke/github/GHPerson.java
index ffc69ba41..286e97e6f 100644
--- a/src/main/java/org/kohsuke/github/GHPerson.java
+++ b/src/main/java/org/kohsuke/github/GHPerson.java
@@ -112,8 +112,8 @@ public abstract class GHPerson extends GHObject {
public synchronized Iterable> iterateRepositories(final int pageSize) {
return new Iterable>() {
public Iterator> iterator() {
- final Iterator pager = root.retrieve().asIterator("/users/" + login + "/repos",
- GHRepository[].class, pageSize);
+ final Iterator pager = root.retrieve()
+ .asIterator("/users/" + login + "/repos", GHRepository[].class, pageSize);
return new Iterator>() {
public boolean hasNext() {
diff --git a/src/main/java/org/kohsuke/github/GHProject.java b/src/main/java/org/kohsuke/github/GHProject.java
index c822f6895..03807b795 100644
--- a/src/main/java/org/kohsuke/github/GHProject.java
+++ b/src/main/java/org/kohsuke/github/GHProject.java
@@ -176,7 +176,7 @@ public class GHProject extends GHObject {
}
private void edit(String key, Object value) throws IOException {
- new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
+ new Requester(root).withPreview(INERTIA).with(key, value).method("PATCH").to(getApiRoute());
}
/**
@@ -282,8 +282,11 @@ public class GHProject extends GHObject {
*/
public PagedIterable listColumns() throws IOException {
final GHProject project = this;
- return root.retrieve().withPreview(INERTIA).asPagedIterable(String.format("/projects/%d/columns", id),
- GHProjectColumn[].class, item -> item.wrap(project));
+ return root.retrieve()
+ .withPreview(INERTIA)
+ .asPagedIterable(String.format("/projects/%d/columns", id),
+ GHProjectColumn[].class,
+ item -> item.wrap(project));
}
/**
@@ -296,7 +299,11 @@ public class GHProject extends GHObject {
* the io exception
*/
public GHProjectColumn createColumn(String name) throws IOException {
- return root.retrieve().method("POST").withPreview(INERTIA).with("name", name)
- .to(String.format("/projects/%d/columns", id), GHProjectColumn.class).wrap(this);
+ return root.retrieve()
+ .method("POST")
+ .withPreview(INERTIA)
+ .with("name", name)
+ .to(String.format("/projects/%d/columns", id), GHProjectColumn.class)
+ .wrap(this);
}
}
\ No newline at end of file
diff --git a/src/main/java/org/kohsuke/github/GHProjectCard.java b/src/main/java/org/kohsuke/github/GHProjectCard.java
index e7cbcbf3f..2ed518fcc 100644
--- a/src/main/java/org/kohsuke/github/GHProjectCard.java
+++ b/src/main/java/org/kohsuke/github/GHProjectCard.java
@@ -198,7 +198,7 @@ public class GHProjectCard extends GHObject {
}
private void edit(String key, Object value) throws IOException {
- new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
+ new Requester(root).withPreview(INERTIA).with(key, value).method("PATCH").to(getApiRoute());
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHProjectColumn.java b/src/main/java/org/kohsuke/github/GHProjectColumn.java
index ac956a5ee..b93f709c3 100644
--- a/src/main/java/org/kohsuke/github/GHProjectColumn.java
+++ b/src/main/java/org/kohsuke/github/GHProjectColumn.java
@@ -106,7 +106,7 @@ public class GHProjectColumn extends GHObject {
}
private void edit(String key, Object value) throws IOException {
- new Requester(root).withPreview(INERTIA)._with(key, value).method("PATCH").to(getApiRoute());
+ new Requester(root).withPreview(INERTIA).with(key, value).method("PATCH").to(getApiRoute());
}
/**
@@ -137,8 +137,11 @@ public class GHProjectColumn extends GHObject {
*/
public PagedIterable listCards() throws IOException {
final GHProjectColumn column = this;
- return root.retrieve().withPreview(INERTIA).asPagedIterable(String.format("/projects/columns/%d/cards", id),
- GHProjectCard[].class, item -> item.wrap(column));
+ return root.retrieve()
+ .withPreview(INERTIA)
+ .asPagedIterable(String.format("/projects/columns/%d/cards", id),
+ GHProjectCard[].class,
+ item -> item.wrap(column));
}
/**
@@ -151,8 +154,12 @@ public class GHProjectColumn extends GHObject {
* the io exception
*/
public GHProjectCard createCard(String note) throws IOException {
- return root.retrieve().method("POST").withPreview(INERTIA).with("note", note)
- .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class).wrap(this);
+ return root.retrieve()
+ .method("POST")
+ .withPreview(INERTIA)
+ .with("note", note)
+ .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class)
+ .wrap(this);
}
/**
@@ -165,9 +172,12 @@ public class GHProjectColumn extends GHObject {
* the io exception
*/
public GHProjectCard createCard(GHIssue issue) throws IOException {
- return root.retrieve().method("POST").withPreview(INERTIA)
+ return root.retrieve()
+ .method("POST")
+ .withPreview(INERTIA)
.with("content_type", issue instanceof GHPullRequest ? "PullRequest" : "Issue")
.with("content_id", issue.getId())
- .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class).wrap(this);
+ .to(String.format("/projects/columns/%d/cards", id), GHProjectCard.class)
+ .wrap(this);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequest.java b/src/main/java/org/kohsuke/github/GHPullRequest.java
index 0ff047b9e..831309b88 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequest.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequest.java
@@ -510,7 +510,8 @@ public class GHPullRequest extends GHIssue implements Refreshable {
* the io exception
*/
public void requestReviewers(List reviewers) throws IOException {
- new Requester(root).method("POST").withLogins("reviewers", reviewers).to(getApiRoute() + REQUEST_REVIEWERS);
+ new Requester(root).method("POST").with("reviewers", getLogins(reviewers))
+ .to(getApiRoute() + REQUEST_REVIEWERS);
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
index 77528ee99..b80902c55 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestCommitDetail.java
@@ -34,8 +34,10 @@ import java.net.URL;
* @author Luca Milanesio
* @see GHPullRequest#listCommits() GHPullRequest#listCommits()
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
- "URF_UNREAD_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" },
+ justification = "JSON API")
public class GHPullRequestCommitDetail {
private GHPullRequest owner;
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java b/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java
index 787503d43..d19d88e27 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestQueryBuilder.java
@@ -88,7 +88,7 @@ public class GHPullRequestQueryBuilder extends GHQueryBuilder {
@Override
public PagedIterable list() {
- return req.withPreview(SHADOW_CAT).asPagedIterable(repo.getApiTailUrl("pulls"), GHPullRequest[].class,
- item -> item.wrapUp(repo));
+ return req.withPreview(SHADOW_CAT)
+ .asPagedIterable(repo.getApiTailUrl("pulls"), GHPullRequest[].class, item -> item.wrapUp(repo));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReview.java b/src/main/java/org/kohsuke/github/GHPullRequestReview.java
index ecf8a51cf..6dc1ee359 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReview.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReview.java
@@ -159,7 +159,9 @@ public class GHPullRequestReview extends GHObject {
* the io exception
*/
public void submit(String body, GHPullRequestReviewEvent event) throws IOException {
- new Requester(owner.root).method("POST").with("body", body).with("event", event.action())
+ new Requester(owner.root).method("POST")
+ .with("body", body)
+ .with("event", event.action())
.to(getApiRoute() + "/events", this);
this.body = body;
this.state = event.toState();
@@ -196,7 +198,9 @@ public class GHPullRequestReview extends GHObject {
* the io exception
*/
public PagedIterable listReviewComments() throws IOException {
- return owner.root.retrieve().asPagedIterable(getApiRoute() + "/comments", GHPullRequestReviewComment[].class,
- item -> item.wrapUp(owner));
+ return owner.root.retrieve()
+ .asPagedIterable(getApiRoute() + "/comments",
+ GHPullRequestReviewComment[].class,
+ item -> item.wrapUp(owner));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
index 80a54cf58..cf0bf2171 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewBuilder.java
@@ -89,8 +89,10 @@ public class GHPullRequestReviewBuilder {
* the io exception
*/
public GHPullRequestReview create() throws IOException {
- return builder.method("POST")._with("comments", comments)
- .to(pr.getApiRoute() + "/reviews", GHPullRequestReview.class).wrapUp(pr);
+ return builder.method("POST")
+ .with("comments", comments)
+ .to(pr.getApiRoute() + "/reviews", GHPullRequestReview.class)
+ .wrapUp(pr);
}
private static class DraftReviewComment {
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
index 108747112..e1e6a1cf7 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewComment.java
@@ -186,21 +186,27 @@ public class GHPullRequestReviewComment extends GHObject implements Reactable {
* the io exception
*/
public GHPullRequestReviewComment reply(String body) throws IOException {
- return new Requester(owner.root).method("POST").with("body", body).with("in_reply_to", getId())
- .to(getApiRoute() + "/comments", GHPullRequestReviewComment.class).wrapUp(owner);
+ return new Requester(owner.root).method("POST")
+ .with("body", body)
+ .with("in_reply_to", getId())
+ .to(getApiRoute() + "/comments", GHPullRequestReviewComment.class)
+ .wrapUp(owner);
}
@Preview
@Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
- return new Requester(owner.root).withPreview(SQUIRREL_GIRL).with("content", content.getContent())
- .to(getApiRoute() + "/reactions", GHReaction.class).wrap(owner.root);
+ return new Requester(owner.root).withPreview(SQUIRREL_GIRL)
+ .with("content", content.getContent())
+ .to(getApiRoute() + "/reactions", GHReaction.class)
+ .wrap(owner.root);
}
@Preview
@Deprecated
public PagedIterable listReactions() {
- return owner.root.retrieve().withPreview(SQUIRREL_GIRL).asPagedIterable(getApiRoute() + "/reactions",
- GHReaction[].class, item -> item.wrap(owner.root));
+ return owner.root.retrieve()
+ .withPreview(SQUIRREL_GIRL)
+ .asPagedIterable(getApiRoute() + "/reactions", GHReaction[].class, item -> item.wrap(owner.root));
}
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java
index 3bcea3311..0d4e681c3 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewEvent.java
@@ -38,14 +38,14 @@ public enum GHPullRequestReviewEvent {
*/
GHPullRequestReviewState toState() {
switch (this) {
- case PENDING:
- return GHPullRequestReviewState.PENDING;
- case APPROVE:
- return GHPullRequestReviewState.APPROVED;
- case REQUEST_CHANGES:
- return GHPullRequestReviewState.CHANGES_REQUESTED;
- case COMMENT:
- return GHPullRequestReviewState.COMMENTED;
+ case PENDING :
+ return GHPullRequestReviewState.PENDING;
+ case APPROVE :
+ return GHPullRequestReviewState.APPROVED;
+ case REQUEST_CHANGES :
+ return GHPullRequestReviewState.CHANGES_REQUESTED;
+ case COMMENT :
+ return GHPullRequestReviewState.COMMENTED;
}
throw new IllegalStateException();
}
diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java b/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java
index 7403992bb..3055cff23 100644
--- a/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java
+++ b/src/main/java/org/kohsuke/github/GHPullRequestReviewState.java
@@ -4,12 +4,16 @@ package org.kohsuke.github;
* Current state of {@link GHPullRequestReview}
*/
public enum GHPullRequestReviewState {
- PENDING, APPROVED, CHANGES_REQUESTED,
+ PENDING,
+ APPROVED,
+ CHANGES_REQUESTED,
/**
* @deprecated This was the thing when this API was in preview, but it changed when it became public. Use
* {@link #CHANGES_REQUESTED}. Left here for compatibility.
*/
- REQUEST_CHANGES, COMMENTED, DISMISSED;
+ REQUEST_CHANGES,
+ COMMENTED,
+ DISMISSED;
/**
* Action string.
@@ -24,16 +28,16 @@ public enum GHPullRequestReviewState {
GHPullRequestReviewEvent toEvent() {
switch (this) {
- case PENDING:
- return GHPullRequestReviewEvent.PENDING;
- case APPROVED:
- return GHPullRequestReviewEvent.APPROVE;
- case CHANGES_REQUESTED:
- return GHPullRequestReviewEvent.REQUEST_CHANGES;
- case REQUEST_CHANGES:
- return GHPullRequestReviewEvent.REQUEST_CHANGES;
- case COMMENTED:
- return GHPullRequestReviewEvent.COMMENT;
+ case PENDING :
+ return GHPullRequestReviewEvent.PENDING;
+ case APPROVED :
+ return GHPullRequestReviewEvent.APPROVE;
+ case CHANGES_REQUESTED :
+ return GHPullRequestReviewEvent.REQUEST_CHANGES;
+ case REQUEST_CHANGES :
+ return GHPullRequestReviewEvent.REQUEST_CHANGES;
+ case COMMENTED :
+ return GHPullRequestReviewEvent.COMMENT;
}
return null;
}
diff --git a/src/main/java/org/kohsuke/github/GHRateLimit.java b/src/main/java/org/kohsuke/github/GHRateLimit.java
index 251b54fa3..08e2cfa53 100644
--- a/src/main/java/org/kohsuke/github/GHRateLimit.java
+++ b/src/main/java/org/kohsuke/github/GHRateLimit.java
@@ -60,7 +60,9 @@ public class GHRateLimit {
private final Record integrationManifest;
static GHRateLimit Unknown() {
- return new GHRateLimit(new UnknownLimitRecord(), new UnknownLimitRecord(), new UnknownLimitRecord(),
+ return new GHRateLimit(new UnknownLimitRecord(),
+ new UnknownLimitRecord(),
+ new UnknownLimitRecord(),
new UnknownLimitRecord());
}
@@ -69,7 +71,8 @@ public class GHRateLimit {
}
@JsonCreator
- GHRateLimit(@Nonnull @JsonProperty("core") Record core, @Nonnull @JsonProperty("search") Record search,
+ GHRateLimit(@Nonnull @JsonProperty("core") Record core,
+ @Nonnull @JsonProperty("search") Record search,
@Nonnull @JsonProperty("graphql") Record graphql,
@Nonnull @JsonProperty("integration_manifest") Record integrationManifest) {
this.core = core;
@@ -266,7 +269,8 @@ public class GHRateLimit {
* the reset epoch seconds
*/
@JsonCreator
- public Record(@JsonProperty("limit") int limit, @JsonProperty("remaining") int remaining,
+ public Record(@JsonProperty("limit") int limit,
+ @JsonProperty("remaining") int remaining,
@JsonProperty("reset") long resetEpochSeconds) {
this(limit, remaining, resetEpochSeconds, null);
}
diff --git a/src/main/java/org/kohsuke/github/GHRef.java b/src/main/java/org/kohsuke/github/GHRef.java
index 529eacc3c..c450aae08 100644
--- a/src/main/java/org/kohsuke/github/GHRef.java
+++ b/src/main/java/org/kohsuke/github/GHRef.java
@@ -94,8 +94,9 @@ public class GHRef {
/**
* The type GHObject.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public static class GHObject {
private String type, sha, url;
diff --git a/src/main/java/org/kohsuke/github/GHRelease.java b/src/main/java/org/kohsuke/github/GHRelease.java
index 5f5ed2aed..796cecf73 100644
--- a/src/main/java/org/kohsuke/github/GHRelease.java
+++ b/src/main/java/org/kohsuke/github/GHRelease.java
@@ -241,7 +241,9 @@ public class GHRelease extends GHObject {
public GHAsset uploadAsset(String filename, InputStream stream, String contentType) throws IOException {
Requester builder = new Requester(owner.root);
- String url = format("https://uploads.github.com%s/releases/%d/assets?name=%s", owner.getApiTailUrl(""), getId(),
+ String url = format("https://uploads.github.com%s/releases/%d/assets?name=%s",
+ owner.getApiTailUrl(""),
+ getId(),
filename);
return builder.contentType(contentType).with(stream).to(url, GHAsset.class).wrap(this);
}
diff --git a/src/main/java/org/kohsuke/github/GHReleaseUpdater.java b/src/main/java/org/kohsuke/github/GHReleaseUpdater.java
index 7f4b1c6f5..3c52eb086 100644
--- a/src/main/java/org/kohsuke/github/GHReleaseUpdater.java
+++ b/src/main/java/org/kohsuke/github/GHReleaseUpdater.java
@@ -99,7 +99,8 @@ public class GHReleaseUpdater {
* the io exception
*/
public GHRelease update() throws IOException {
- return builder.method("PATCH").to(base.owner.getApiTailUrl("releases/" + base.id), GHRelease.class)
+ return builder.method("PATCH")
+ .to(base.owner.getApiTailUrl("releases/" + base.id), GHRelease.class)
.wrap(base.owner);
}
diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java
index e6dd1e715..758803428 100644
--- a/src/main/java/org/kohsuke/github/GHRepository.java
+++ b/src/main/java/org/kohsuke/github/GHRepository.java
@@ -67,8 +67,8 @@ import static org.kohsuke.github.Previews.*;
* @author Kohsuke Kawaguchi
*/
@SuppressWarnings({ "UnusedDeclaration" })
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GHRepository extends GHObject {
/* package almost final */ GitHub root;
@@ -142,11 +142,13 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listDeployments(String sha, String ref, String task, String environment) {
- List params = Arrays.asList(getParam("sha", sha), getParam("ref", ref), getParam("task", task),
+ List params = Arrays.asList(getParam("sha", sha),
+ getParam("ref", ref),
+ getParam("task", task),
getParam("environment", environment));
final String deploymentsUrl = getApiTailUrl("deployments") + "?" + join(params, "&");
- return root.retrieve().asPagedIterable(deploymentsUrl, GHDeployment[].class,
- item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .asPagedIterable(deploymentsUrl, GHDeployment[].class, item -> item.wrap(GHRepository.this));
}
/**
@@ -390,7 +392,8 @@ public class GHRepository extends GHObject {
* the io exception
*/
public List getIssues(GHIssueState state, GHMilestone milestone) throws IOException {
- return Arrays.asList(GHIssue.wrap(root.retrieve().with("state", state)
+ return Arrays.asList(GHIssue.wrap(root.retrieve()
+ .with("state", state)
.with("milestone", milestone == null ? "none" : "" + milestone.getNumber())
.to(getApiTailUrl("issues"), GHIssue[].class), this));
}
@@ -403,8 +406,9 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listIssues(final GHIssueState state) {
- return root.retrieve().with("state", state).asPagedIterable(getApiTailUrl("issues"), GHIssue[].class,
- item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .with("state", state)
+ .asPagedIterable(getApiTailUrl("issues"), GHIssue[].class, item -> item.wrap(GHRepository.this));
}
/**
@@ -431,8 +435,11 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHRef createRef(String name, String sha) throws IOException {
- return new Requester(root).with("ref", name).with("sha", sha).method("POST")
- .to(getApiTailUrl("git/refs"), GHRef.class).wrap(root);
+ return new Requester(root).with("ref", name)
+ .with("sha", sha)
+ .method("POST")
+ .to(getApiTailUrl("git/refs"), GHRef.class)
+ .wrap(root);
}
/**
@@ -504,8 +511,8 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listReleases() throws IOException {
- return root.retrieve().asPagedIterable(getApiTailUrl("releases"), GHRelease[].class,
- item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .asPagedIterable(getApiTailUrl("releases"), GHRelease[].class, item -> item.wrap(GHRepository.this));
}
/**
@@ -516,8 +523,8 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listTags() throws IOException {
- return root.retrieve().asPagedIterable(getApiTailUrl("tags"), GHTag[].class,
- item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .asPagedIterable(getApiTailUrl("tags"), GHTag[].class, item -> item.wrap(GHRepository.this));
}
/**
@@ -802,8 +809,8 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHPermissionType getPermission(String user) throws IOException {
- GHPermission perm = root.retrieve().to(getApiTailUrl("collaborators/" + user + "/permission"),
- GHPermission.class);
+ GHPermission perm = root.retrieve()
+ .to(getApiTailUrl("collaborators/" + user + "/permission"), GHPermission.class);
perm.wrapUp(root);
return perm.getPermissionType();
}
@@ -829,8 +836,9 @@ public class GHRepository extends GHObject {
* the io exception
*/
public Set getTeams() throws IOException {
- return Collections.unmodifiableSet(new HashSet(Arrays.asList(GHTeam.wrapUp(
- root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class), root.getOrganization(getOwnerName())))));
+ return Collections.unmodifiableSet(new HashSet(
+ Arrays.asList(GHTeam.wrapUp(root.retrieve().to(getApiTailUrl("teams"), GHTeam[].class),
+ root.getOrganization(getOwnerName())))));
}
/**
@@ -898,7 +906,10 @@ public class GHRepository extends GHObject {
public void setEmailServiceHook(String address) throws IOException {
Map config = new HashMap();
config.put("address", address);
- new Requester(root).method("POST").with("name", "email").with("config", config).with("active", true)
+ new Requester(root).method("POST")
+ .with("name", "email")
+ .with("config", config)
+ .with("active", true)
.to(getApiTailUrl("hooks"));
}
@@ -1107,8 +1118,9 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listForks(final ForkSort sort) {
- return root.retrieve().with("sort", sort).asPagedIterable(getApiTailUrl("forks"), GHRepository[].class,
- item -> item.wrap(root));
+ return root.retrieve()
+ .with("sort", sort)
+ .asPagedIterable(getApiTailUrl("forks"), GHRepository[].class, item -> item.wrap(root));
}
/**
@@ -1171,7 +1183,9 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHPullRequest getPullRequest(int i) throws IOException {
- return root.retrieve().withPreview(SHADOW_CAT).to(getApiTailUrl("pulls/" + i), GHPullRequest.class)
+ return root.retrieve()
+ .withPreview(SHADOW_CAT)
+ .to(getApiTailUrl("pulls/" + i), GHPullRequest.class)
.wrapUp(this);
}
@@ -1250,7 +1264,10 @@ public class GHRepository extends GHObject {
* @throws IOException
* the io exception
*/
- public GHPullRequest createPullRequest(String title, String head, String base, String body,
+ public GHPullRequest createPullRequest(String title,
+ String head,
+ String base,
+ String body,
boolean maintainerCanModify) throws IOException {
return createPullRequest(title, head, base, body, maintainerCanModify, false);
}
@@ -1276,11 +1293,21 @@ public class GHRepository extends GHObject {
* @throws IOException
* the io exception
*/
- public GHPullRequest createPullRequest(String title, String head, String base, String body,
- boolean maintainerCanModify, boolean draft) throws IOException {
- return new Requester(root).withPreview(SHADOW_CAT).with("title", title).with("head", head).with("base", base)
- .with("body", body).with("maintainer_can_modify", maintainerCanModify).with("draft", draft)
- .to(getApiTailUrl("pulls"), GHPullRequest.class).wrapUp(this);
+ public GHPullRequest createPullRequest(String title,
+ String head,
+ String base,
+ String body,
+ boolean maintainerCanModify,
+ boolean draft) throws IOException {
+ return new Requester(root).withPreview(SHADOW_CAT)
+ .with("title", title)
+ .with("head", head)
+ .with("base", base)
+ .with("body", body)
+ .with("maintainer_can_modify", maintainerCanModify)
+ .with("draft", draft)
+ .to(getApiTailUrl("pulls"), GHPullRequest.class)
+ .wrapUp(this);
}
/**
@@ -1321,8 +1348,8 @@ public class GHRepository extends GHObject {
* on failure communicating with GitHub
*/
public GHCompare getCompare(String id1, String id2) throws IOException {
- GHCompare compare = root.retrieve().to(getApiTailUrl(String.format("compare/%s...%s", id1, id2)),
- GHCompare.class);
+ GHCompare compare = root.retrieve()
+ .to(getApiTailUrl(String.format("compare/%s...%s", id1, id2)), GHCompare.class);
return compare.wrap(this);
}
@@ -1381,7 +1408,8 @@ public class GHRepository extends GHObject {
*/
public GHRef[] getRefs() throws IOException {
return GHRef.wrap(
- root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class), root);
+ root.retrieve().to(String.format("/repos/%s/%s/git/refs", getOwnerName(), name), GHRef[].class),
+ root);
}
/**
@@ -1406,8 +1434,10 @@ public class GHRepository extends GHObject {
* on failure communicating with GitHub, potentially due to an invalid ref type being requested
*/
public GHRef[] getRefs(String refType) throws IOException {
- return GHRef.wrap(root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType),
- GHRef[].class), root);
+ return GHRef.wrap(
+ root.retrieve()
+ .to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refType), GHRef[].class),
+ root);
}
/**
@@ -1439,7 +1469,8 @@ public class GHRepository extends GHObject {
// URLEncoder.encode()?
// OTOH, '/' need no escaping
refName = refName.replaceAll("#", "%23");
- return root.retrieve().to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.class)
+ return root.retrieve()
+ .to(String.format("/repos/%s/%s/git/refs/%s", getOwnerName(), name, refName), GHRef.class)
.wrap(root);
}
@@ -1553,7 +1584,8 @@ public class GHRepository extends GHObject {
public GHCommit getCommit(String sha1) throws IOException {
GHCommit c = commits.get(sha1);
if (c == null) {
- c = root.retrieve().to(String.format("/repos/%s/%s/commits/%s", getOwnerName(), name, sha1), GHCommit.class)
+ c = root.retrieve()
+ .to(String.format("/repos/%s/%s/commits/%s", getOwnerName(), name, sha1), GHCommit.class)
.wrapUp(this);
commits.put(sha1, c);
}
@@ -1575,8 +1607,10 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listCommits() {
- return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/commits", getOwnerName(), name),
- GHCommit[].class, item -> item.wrapUp(GHRepository.this));
+ return root.retrieve()
+ .asPagedIterable(String.format("/repos/%s/%s/commits", getOwnerName(), name),
+ GHCommit[].class,
+ item -> item.wrapUp(GHRepository.this));
}
/**
@@ -1594,8 +1628,10 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listCommitComments() {
- return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/comments", getOwnerName(), name),
- GHCommitComment[].class, item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .asPagedIterable(String.format("/repos/%s/%s/comments", getOwnerName(), name),
+ GHCommitComment[].class,
+ item -> item.wrap(GHRepository.this));
}
/**
@@ -1641,8 +1677,10 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listCommitStatuses(final String sha1) throws IOException {
- return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/statuses/%s", getOwnerName(), name, sha1),
- GHCommitStatus[].class, item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(String.format("/repos/%s/%s/statuses/%s", getOwnerName(), name, sha1),
+ GHCommitStatus[].class,
+ item -> item.wrapUp(root));
}
/**
@@ -1676,9 +1714,14 @@ public class GHRepository extends GHObject {
* @throws IOException
* the io exception
*/
- public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, String targetUrl, String description,
+ public GHCommitStatus createCommitStatus(String sha1,
+ GHCommitState state,
+ String targetUrl,
+ String description,
String context) throws IOException {
- return new Requester(root).with("state", state).with("target_url", targetUrl).with("description", description)
+ return new Requester(root).with("state", state)
+ .with("target_url", targetUrl)
+ .with("description", description)
.with("context", context)
.to(String.format("/repos/%s/%s/statuses/%s", getOwnerName(), this.name, sha1), GHCommitStatus.class)
.wrapUp(root);
@@ -1714,8 +1757,10 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listEvents() throws IOException {
- return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/events", getOwnerName(), name),
- GHEventInfo[].class, item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(String.format("/repos/%s/%s/events", getOwnerName(), name),
+ GHEventInfo[].class,
+ item -> item.wrapUp(root));
}
/**
@@ -1728,8 +1773,9 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listLabels() throws IOException {
- return root.retrieve().withPreview(SYMMETRA).asPagedIterable(getApiTailUrl("labels"), GHLabel[].class,
- item -> item.wrapUp(GHRepository.this));
+ return root.retrieve()
+ .withPreview(SYMMETRA)
+ .asPagedIterable(getApiTailUrl("labels"), GHLabel[].class, item -> item.wrapUp(GHRepository.this));
}
/**
@@ -1776,8 +1822,14 @@ public class GHRepository extends GHObject {
@Preview
@Deprecated
public GHLabel createLabel(String name, String color, String description) throws IOException {
- return root.retrieve().method("POST").withPreview(SYMMETRA).with("name", name).with("color", color)
- .with("description", description).to(getApiTailUrl("labels"), GHLabel.class).wrapUp(this);
+ return root.retrieve()
+ .method("POST")
+ .withPreview(SYMMETRA)
+ .with("name", name)
+ .with("color", color)
+ .with("description", description)
+ .to(getApiTailUrl("labels"), GHLabel.class)
+ .wrapUp(this);
}
/**
@@ -1786,8 +1838,10 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listInvitations() {
- return root.retrieve().asPagedIterable(String.format("/repos/%s/%s/invitations", getOwnerName(), name),
- GHInvitation[].class, item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(String.format("/repos/%s/%s/invitations", getOwnerName(), name),
+ GHInvitation[].class,
+ item -> item.wrapUp(root));
}
/**
@@ -1818,8 +1872,11 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listStargazers2() {
- return root.retrieve().withPreview("application/vnd.github.v3.star+json").asPagedIterable(
- getApiTailUrl("stargazers"), GHStargazer[].class, item -> item.wrapUp(GHRepository.this));
+ return root.retrieve()
+ .withPreview("application/vnd.github.v3.star+json")
+ .asPagedIterable(getApiTailUrl("stargazers"),
+ GHStargazer[].class,
+ item -> item.wrapUp(GHRepository.this));
}
private PagedIterable listUsers(final String suffix) {
@@ -1890,7 +1947,8 @@ public class GHRepository extends GHObject {
* @return the post commit hooks
* @deprecated Use {@link #getHooks()} and {@link #createHook(String, Map, Collection, boolean)}
*/
- @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "It causes a performance degradation, but we have already exposed it to the API")
+ @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
+ justification = "It causes a performance degradation, but we have already exposed it to the API")
public Set getPostCommitHooks() {
return postCommitHooks;
}
@@ -1898,7 +1956,8 @@ public class GHRepository extends GHObject {
/**
* Live set view of the post-commit hook.
*/
- @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS", justification = "It causes a performance degradation, but we have already exposed it to the API")
+ @SuppressFBWarnings(value = "DMI_COLLECTION_OF_URLS",
+ justification = "It causes a performance degradation, but we have already exposed it to the API")
@SkipFromToString
private final Set postCommitHooks = new AbstractSet() {
private List getPostCommitHooks() {
@@ -2032,8 +2091,11 @@ public class GHRepository extends GHObject {
* @return the paged iterable
*/
public PagedIterable listMilestones(final GHIssueState state) {
- return root.retrieve().with("state", state).asPagedIterable(getApiTailUrl("milestones"), GHMilestone[].class,
- item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .with("state", state)
+ .asPagedIterable(getApiTailUrl("milestones"),
+ GHMilestone[].class,
+ item -> item.wrap(GHRepository.this));
}
/**
@@ -2237,8 +2299,11 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHMilestone createMilestone(String title, String description) throws IOException {
- return new Requester(root).with("title", title).with("description", description).method("POST")
- .to(getApiTailUrl("milestones"), GHMilestone.class).wrap(this);
+ return new Requester(root).with("title", title)
+ .with("description", description)
+ .method("POST")
+ .to(getApiTailUrl("milestones"), GHMilestone.class)
+ .wrap(this);
}
/**
@@ -2253,8 +2318,11 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHDeployKey addDeployKey(String title, String key) throws IOException {
- return new Requester(root).with("title", title).with("key", key).method("POST")
- .to(getApiTailUrl("keys"), GHDeployKey.class).wrap(this);
+ return new Requester(root).with("title", title)
+ .with("key", key)
+ .method("POST")
+ .to(getApiTailUrl("keys"), GHDeployKey.class)
+ .wrap(this);
}
@@ -2320,8 +2388,11 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException {
- return new Requester(root).with("subscribed", subscribed).with("ignored", ignored).method("PUT")
- .to(getApiTailUrl("subscription"), GHSubscription.class).wrapUp(this);
+ return new Requester(root).with("subscribed", subscribed)
+ .with("ignored", ignored)
+ .method("PUT")
+ .to(getApiTailUrl("subscription"), GHSubscription.class)
+ .wrapUp(this);
}
/**
@@ -2347,8 +2418,8 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listContributors() throws IOException {
- return root.retrieve().asPagedIterable(getApiTailUrl("contributors"), Contributor[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(getApiTailUrl("contributors"), Contributor[].class, item -> item.wrapUp(root));
}
/**
@@ -2402,8 +2473,13 @@ public class GHRepository extends GHObject {
* the io exception
*/
public GHProject createProject(String name, String body) throws IOException {
- return root.retrieve().method("POST").withPreview(INERTIA).with("name", name).with("body", body)
- .to(getApiTailUrl("projects"), GHProject.class).wrap(this);
+ return root.retrieve()
+ .method("POST")
+ .withPreview(INERTIA)
+ .with("name", name)
+ .with("body", body)
+ .to(getApiTailUrl("projects"), GHProject.class)
+ .wrap(this);
}
/**
@@ -2416,8 +2492,10 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listProjects(final GHProject.ProjectStateFilter status) throws IOException {
- return root.retrieve().withPreview(INERTIA).with("state", status).asPagedIterable(getApiTailUrl("projects"),
- GHProject[].class, item -> item.wrap(GHRepository.this));
+ return root.retrieve()
+ .withPreview(INERTIA)
+ .with("state", status)
+ .asPagedIterable(getApiTailUrl("projects"), GHProject[].class, item -> item.wrap(GHRepository.this));
}
/**
@@ -2446,10 +2524,10 @@ public class GHRepository extends GHObject {
* @see GitHub#renderMarkdown(String) GitHub#renderMarkdown(String)
*/
public Reader renderMarkdown(String text, MarkdownMode mode) throws IOException {
- return new InputStreamReader(
- new Requester(root).with("text", text).with("mode", mode == null ? null : mode.toString())
- .with("context", getFullName()).asStream("/markdown"),
- "UTF-8");
+ return new InputStreamReader(new Requester(root).with("text", text)
+ .with("mode", mode == null ? null : mode.toString())
+ .with("context", getFullName())
+ .asStream("/markdown"), "UTF-8");
}
/**
@@ -2514,8 +2592,8 @@ public class GHRepository extends GHObject {
* the io exception
*/
public PagedIterable listIssueEvents() throws IOException {
- return root.retrieve().asPagedIterable(getApiTailUrl("issues/events"), GHIssueEvent[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(getApiTailUrl("issues/events"), GHIssueEvent[].class, item -> item.wrapUp(root));
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java b/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java
index 41f43ec4f..6edeb733c 100644
--- a/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java
+++ b/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java
@@ -86,15 +86,17 @@ public class GHRepositoryStatistics {
* This gets the actual statistics from the server. Returns null if they are still being cached.
*/
private PagedIterable getContributorStatsImpl() throws IOException {
- return root.retrieve().asPagedIterable(getApiTailUrl("contributors"), ContributorStats[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(getApiTailUrl("contributors"), ContributorStats[].class, item -> item.wrapUp(root));
}
/**
* The type ContributorStats.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" },
+ justification = "JSON API")
public static class ContributorStats extends GHObject {
/* package almost final */ private GitHub root;
private GHUser author;
@@ -172,8 +174,10 @@ public class GHRepositoryStatistics {
/**
* The type Week.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
+ "URF_UNREAD_FIELD" },
+ justification = "JSON API")
public static class Week {
private long w;
@@ -238,15 +242,16 @@ public class GHRepositoryStatistics {
* the io exception
*/
public PagedIterable getCommitActivity() throws IOException {
- return root.retrieve().asPagedIterable(getApiTailUrl("commit_activity"), CommitActivity[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(getApiTailUrl("commit_activity"), CommitActivity[].class, item -> item.wrapUp(root));
}
/**
* The type CommitActivity.
*/
- @SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+ @SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public static class CommitActivity extends GHObject {
/* package almost final */ private GitHub root;
private List days;
diff --git a/src/main/java/org/kohsuke/github/GHTag.java b/src/main/java/org/kohsuke/github/GHTag.java
index 8281af2ea..383219925 100644
--- a/src/main/java/org/kohsuke/github/GHTag.java
+++ b/src/main/java/org/kohsuke/github/GHTag.java
@@ -7,8 +7,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
*
* @see GHRepository#listTags() GHRepository#listTags()
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GHTag {
private GHRepository owner;
private GitHub root;
diff --git a/src/main/java/org/kohsuke/github/GHTagObject.java b/src/main/java/org/kohsuke/github/GHTagObject.java
index e880e8e47..4c0234e20 100644
--- a/src/main/java/org/kohsuke/github/GHTagObject.java
+++ b/src/main/java/org/kohsuke/github/GHTagObject.java
@@ -7,8 +7,8 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
*
* @see GHRepository#getTagObject(String) GHRepository#getTagObject(String)
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GHTagObject {
private GHRepository owner;
private GitHub root;
diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java
index 9e3c0612c..9254817b9 100644
--- a/src/main/java/org/kohsuke/github/GHTeam.java
+++ b/src/main/java/org/kohsuke/github/GHTeam.java
@@ -243,7 +243,9 @@ public class GHTeam implements Refreshable {
* the io exception
*/
public void add(GHRepository r, GHOrganization.Permission permission) throws IOException {
- root.retrieve().method("PUT").with("permission", permission)
+ root.retrieve()
+ .method("PUT")
+ .with("permission", permission)
.to(api("/repos/" + r.getOwnerName() + '/' + r.getName()), null);
}
diff --git a/src/main/java/org/kohsuke/github/GHThread.java b/src/main/java/org/kohsuke/github/GHThread.java
index 240c4084f..52b942512 100644
--- a/src/main/java/org/kohsuke/github/GHThread.java
+++ b/src/main/java/org/kohsuke/github/GHThread.java
@@ -14,8 +14,8 @@ import java.util.Date;
* @see documentation
* @see GHNotificationStream
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GHThread extends GHObject {
private GitHub root;
private GHRepository repository;
@@ -176,8 +176,11 @@ public class GHThread extends GHObject {
* the io exception
*/
public GHSubscription subscribe(boolean subscribed, boolean ignored) throws IOException {
- return new Requester(root).with("subscribed", subscribed).with("ignored", ignored).method("PUT")
- .to(subscription_url, GHSubscription.class).wrapUp(root);
+ return new Requester(root).with("subscribed", subscribed)
+ .with("ignored", ignored)
+ .method("PUT")
+ .to(subscription_url, GHSubscription.class)
+ .wrapUp(root);
}
/**
diff --git a/src/main/java/org/kohsuke/github/GHTreeBuilder.java b/src/main/java/org/kohsuke/github/GHTreeBuilder.java
index d6c81b930..68ccfcb73 100644
--- a/src/main/java/org/kohsuke/github/GHTreeBuilder.java
+++ b/src/main/java/org/kohsuke/github/GHTreeBuilder.java
@@ -120,7 +120,7 @@ public class GHTreeBuilder {
* the io exception
*/
public GHTree create() throws IOException {
- req._with("tree", treeEntries);
+ req.with("tree", treeEntries);
return req.method("POST").to(getApiTail(), GHTree.class).wrap(repo);
}
}
diff --git a/src/main/java/org/kohsuke/github/GHUser.java b/src/main/java/org/kohsuke/github/GHUser.java
index 332721be5..73cdfea9b 100644
--- a/src/main/java/org/kohsuke/github/GHUser.java
+++ b/src/main/java/org/kohsuke/github/GHUser.java
@@ -197,8 +197,10 @@ public class GHUser extends GHPerson {
* Lists events performed by a user (this includes private events if the caller is authenticated.
*/
public PagedIterable listEvents() throws IOException {
- return root.retrieve().asPagedIterable(String.format("/users/%s/events", login), GHEventInfo[].class,
- item -> item.wrapUp(root));
+ return root.retrieve()
+ .asPagedIterable(String.format("/users/%s/events", login),
+ GHEventInfo[].class,
+ item -> item.wrapUp(root));
}
/**
@@ -209,8 +211,10 @@ public class GHUser extends GHPerson {
* the io exception
*/
public PagedIterable listGists() throws IOException {
- return root.retrieve().asPagedIterable(String.format("/users/%s/gists", login), GHGist[].class,
- item -> item.wrapUp(GHUser.this));
+ return root.retrieve()
+ .asPagedIterable(String.format("/users/%s/gists", login),
+ GHGist[].class,
+ item -> item.wrapUp(GHUser.this));
}
@Override
diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java
index 78b9885c0..a6918e4b6 100644
--- a/src/main/java/org/kohsuke/github/GitHub.java
+++ b/src/main/java/org/kohsuke/github/GitHub.java
@@ -128,9 +128,14 @@ public class GitHub {
* @param connector
* HttpConnector to use. Pass null to use default connector.
*/
- GitHub(String apiUrl, String login, String oauthAccessToken, String jwtToken, String password,
- HttpConnector connector, RateLimitHandler rateLimitHandler, AbuseLimitHandler abuseLimitHandler)
- throws IOException {
+ GitHub(String apiUrl,
+ String login,
+ String oauthAccessToken,
+ String jwtToken,
+ String password,
+ HttpConnector connector,
+ RateLimitHandler rateLimitHandler,
+ AbuseLimitHandler abuseLimitHandler) throws IOException {
if (apiUrl.endsWith("/"))
apiUrl = apiUrl.substring(0, apiUrl.length() - 1); // normalize
this.apiUrl = apiUrl;
@@ -345,7 +350,8 @@ public class GitHub {
*/
public static GitHub offline() {
try {
- return new GitHubBuilder().withEndpoint("https://api.github.invalid").withConnector(HttpConnector.OFFLINE)
+ return new GitHubBuilder().withEndpoint("https://api.github.invalid")
+ .withConnector(HttpConnector.OFFLINE)
.build();
} catch (IOException e) {
throw new IllegalStateException("The offline implementation constructor should not connect", e);
@@ -624,8 +630,8 @@ public class GitHub {
* @see List All Orgs - Parameters
*/
public PagedIterable listOrganizations(final String since) {
- return retrieve().with("since", since).asPagedIterable("/organizations", GHOrganization[].class,
- item -> item.wrapUp(GitHub.this));
+ return retrieve().with("since", since)
+ .asPagedIterable("/organizations", GHOrganization[].class, item -> item.wrapUp(GitHub.this));
}
/**
@@ -949,8 +955,9 @@ public class GitHub {
return createToken(scope, note, noteUrl);
} catch (GHOTPRequiredException ex) {
String OTPstring = OTP.get();
- Requester requester = new Requester(this).with("scopes", scope).with("note", note).with("note_url",
- noteUrl);
+ Requester requester = new Requester(this).with("scopes", scope)
+ .with("note", note)
+ .with("note_url", noteUrl);
// Add the OTP from the user
requester.setHeader("x-github-otp", OTPstring);
return requester.method("POST").to("/authorizations", GHAuthorization.class).wrap(this);
@@ -976,10 +983,15 @@ public class GitHub {
* @see docs
*/
- public GHAuthorization createOrGetAuth(String clientId, String clientSecret, List scopes, String note,
+ public GHAuthorization createOrGetAuth(String clientId,
+ String clientSecret,
+ List scopes,
+ String note,
String note_url) throws IOException {
- Requester requester = new Requester(this).with("client_secret", clientSecret).with("scopes", scopes)
- .with("note", note).with("note_url", note_url);
+ Requester requester = new Requester(this).with("client_secret", clientSecret)
+ .with("scopes", scopes)
+ .with("note", note)
+ .with("note_url", note_url);
return requester.method("PUT").to("/authorizations/clients/" + clientId, GHAuthorization.class);
}
@@ -1029,8 +1041,8 @@ public class GitHub {
* authorization
*/
public GHAuthorization resetAuth(@Nonnull String clientId, @Nonnull String accessToken) throws IOException {
- return retrieve().method("POST").to("/applications/" + clientId + "/tokens/" + accessToken,
- GHAuthorization.class);
+ return retrieve().method("POST")
+ .to("/applications/" + clientId + "/tokens/" + accessToken, GHAuthorization.class);
}
/**
@@ -1306,8 +1318,8 @@ public class GitHub {
* @see documentation
*/
public PagedIterable listAllPublicRepositories(final String since) {
- return retrieve().with("since", since).asPagedIterable("/repositories", GHRepository[].class,
- item -> item.wrap(GitHub.this));
+ return retrieve().with("since", since)
+ .asPagedIterable("/repositories", GHRepository[].class, item -> item.wrap(GitHub.this));
}
/**
@@ -1326,7 +1338,8 @@ public class GitHub {
*/
public Reader renderMarkdown(String text) throws IOException {
return new InputStreamReader(new Requester(this).with(new ByteArrayInputStream(text.getBytes("UTF-8")))
- .contentType("text/plain;charset=UTF-8").asStream("/markdown/raw"), "UTF-8");
+ .contentType("text/plain;charset=UTF-8")
+ .asStream("/markdown/raw"), "UTF-8");
}
static URL parseURL(String s) {
diff --git a/src/main/java/org/kohsuke/github/GitHubBuilder.java b/src/main/java/org/kohsuke/github/GitHubBuilder.java
index 3fe8cb7ec..63f0877d9 100644
--- a/src/main/java/org/kohsuke/github/GitHubBuilder.java
+++ b/src/main/java/org/kohsuke/github/GitHubBuilder.java
@@ -90,7 +90,8 @@ public class GitHubBuilder implements Cloneable {
* @deprecated Use {@link #fromEnvironment()} to pick up standard set of environment variables, so that different
* clients of this library will all recognize one consistent set of coordinates.
*/
- public static GitHubBuilder fromEnvironment(String loginVariableName, String passwordVariableName,
+ public static GitHubBuilder fromEnvironment(String loginVariableName,
+ String passwordVariableName,
String oauthVariableName) throws IOException {
return fromEnvironment(loginVariableName, passwordVariableName, oauthVariableName, "");
}
@@ -118,8 +119,10 @@ public class GitHubBuilder implements Cloneable {
* @deprecated Use {@link #fromEnvironment()} to pick up standard set of environment variables, so that different
* clients of this library will all recognize one consistent set of coordinates.
*/
- public static GitHubBuilder fromEnvironment(String loginVariableName, String passwordVariableName,
- String oauthVariableName, String endpointVariableName) throws IOException {
+ public static GitHubBuilder fromEnvironment(String loginVariableName,
+ String passwordVariableName,
+ String oauthVariableName,
+ String endpointVariableName) throws IOException {
Properties env = new Properties();
loadIfSet(loginVariableName, env, "login");
loadIfSet(passwordVariableName, env, "password");
@@ -355,7 +358,13 @@ public class GitHubBuilder implements Cloneable {
* the io exception
*/
public GitHub build() throws IOException {
- return new GitHub(endpoint, user, oauthToken, jwtToken, password, connector, rateLimitHandler,
+ return new GitHub(endpoint,
+ user,
+ oauthToken,
+ jwtToken,
+ password,
+ connector,
+ rateLimitHandler,
abuseLimitHandler);
}
diff --git a/src/main/java/org/kohsuke/github/GitUser.java b/src/main/java/org/kohsuke/github/GitUser.java
index 8c32ae6de..6a887b580 100644
--- a/src/main/java/org/kohsuke/github/GitUser.java
+++ b/src/main/java/org/kohsuke/github/GitUser.java
@@ -12,8 +12,8 @@ import java.util.Date;
*
* @author Kohsuke Kawaguchi
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
+@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
+ justification = "JSON API")
public class GitUser {
private String name, email, date;
diff --git a/src/main/java/org/kohsuke/github/PagedSearchIterable.java b/src/main/java/org/kohsuke/github/PagedSearchIterable.java
index d79b74332..4e3b84650 100644
--- a/src/main/java/org/kohsuke/github/PagedSearchIterable.java
+++ b/src/main/java/org/kohsuke/github/PagedSearchIterable.java
@@ -11,8 +11,10 @@ import java.util.Iterator;
* the type parameter
* @author Kohsuke Kawaguchi
*/
-@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
- "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "Constructed by JSON API")
+@SuppressFBWarnings(
+ value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
+ "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
+ justification = "Constructed by JSON API")
public abstract class PagedSearchIterable extends PagedIterable {
private final GitHub root;
diff --git a/src/main/java/org/kohsuke/github/Requester.java b/src/main/java/org/kohsuke/github/Requester.java
index fcb8f44a0..1a86bf407 100644
--- a/src/main/java/org/kohsuke/github/Requester.java
+++ b/src/main/java/org/kohsuke/github/Requester.java
@@ -46,6 +46,7 @@ import java.net.URL;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Collection;
+import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
@@ -60,9 +61,7 @@ import java.util.regex.Pattern;
import java.util.zip.GZIPInputStream;
import static java.util.Arrays.asList;
-import static java.util.logging.Level.FINE;
-import static java.util.logging.Level.FINEST;
-import static java.util.logging.Level.INFO;
+import static java.util.logging.Level.*;
import static org.apache.commons.lang3.StringUtils.defaultString;
import static org.kohsuke.github.GitHub.MAPPER;
@@ -131,22 +130,10 @@ class Requester {
return this;
}
- Requester withPreview(String name) {
+ public Requester withPreview(String name) {
return withHeader("Accept", name);
}
- /**
- * Makes a request with authentication credential.
- *
- * @return the requester
- */
- @Deprecated
- public Requester withCredential() {
- // keeping it inline with retrieveWithAuth not to enforce the check
- // root.requireCredential();
- return this;
- }
-
/**
* With requester.
*
@@ -157,7 +144,7 @@ class Requester {
* @return the requester
*/
public Requester with(String key, int value) {
- return _with(key, value);
+ return with(key, (Object) value);
}
/**
@@ -170,22 +157,7 @@ class Requester {
* @return the requester
*/
public Requester with(String key, long value) {
- return _with(key, value);
- }
-
- /**
- * With requester.
- *
- * @param key
- * the key
- * @param value
- * the value
- * @return the requester
- */
- public Requester with(String key, Integer value) {
- if (value != null)
- _with(key, value);
- return this;
+ return with(key, (Object) value);
}
/**
@@ -198,20 +170,7 @@ class Requester {
* @return the requester
*/
public Requester with(String key, boolean value) {
- return _with(key, value);
- }
-
- /**
- * With requester.
- *
- * @param key
- * the key
- * @param value
- * the value
- * @return the requester
- */
- public Requester with(String key, Boolean value) {
- return _with(key, value);
+ return with(key, (Object) value);
}
/**
@@ -225,7 +184,7 @@ class Requester {
*/
public Requester with(String key, Enum e) {
if (e == null)
- return _with(key, null);
+ return with(key, (Object) null);
return with(key, transformEnum(e));
}
@@ -239,7 +198,7 @@ class Requester {
* @return the requester
*/
public Requester with(String key, String value) {
- return _with(key, value);
+ return with(key, (Object) value);
}
/**
@@ -252,24 +211,7 @@ class Requester {
* @return the requester
*/
public Requester with(String key, Collection> value) {
- return _with(key, value);
- }
-
- /**
- * With logins requester.
- *
- * @param key
- * the key
- * @param users
- * the users
- * @return the requester
- */
- public Requester withLogins(String key, Collection users) {
- List names = new ArrayList(users.size());
- for (GHUser a : users) {
- names.add(a.getLogin());
- }
- return with(key, names);
+ return with(key, (Object) value);
}
/**
@@ -282,24 +224,7 @@ class Requester {
* @return the requester
*/
public Requester with(String key, Map value) {
- return _with(key, value);
- }
-
- /**
- * With permissions requester.
- *
- * @param key
- * the key
- * @param value
- * the value
- * @return the requester
- */
- public Requester withPermissions(String key, Map value) {
- Map retMap = new HashMap();
- for (Map.Entry entry : value.entrySet()) {
- retMap.put(entry.getKey(), transformEnum(entry.getValue()));
- }
- return _with(key, retMap);
+ return with(key, (Object) value);
}
/**
@@ -337,7 +262,7 @@ class Requester {
* the value
* @return the requester
*/
- public Requester _with(String key, Object value) {
+ public Requester with(String key, Object value) {
if (value != null) {
args.add(new Entry(key, value));
}
@@ -360,7 +285,7 @@ class Requester {
return this;
}
}
- return _with(key, value);
+ return with(key, value);
}
/**
@@ -392,7 +317,7 @@ class Requester {
* Normally whether parameters go as query parameters or a body depends on the HTTP verb in use, but this method
* forces the parameters to be sent as a body.
*/
- Requester inBody() {
+ public Requester inBody() {
forceBody = true;
return this;
}
@@ -406,7 +331,7 @@ class Requester {
* the io exception
*/
public void to(String tailApiUrl) throws IOException {
- to(tailApiUrl, null);
+ _to(tailApiUrl, null, null);
}
/**
@@ -443,26 +368,6 @@ class Requester {
return _to(tailApiUrl, null, existingInstance);
}
- /**
- * Short for {@code method(method).to(tailApiUrl,type)}
- *
- * @param
- * the type parameter
- * @param tailApiUrl
- * the tail api url
- * @param type
- * the type
- * @param method
- * the method
- * @return the t
- * @throws IOException
- * the io exception
- */
- @Deprecated
- public T to(String tailApiUrl, Class type, String method) throws IOException {
- return method(method).to(tailApiUrl, type);
- }
-
@SuppressFBWarnings("SBSC_USE_STRINGBUFFER_CONCATENATION")
private T _to(String tailApiUrl, Class type, T instance) throws IOException {
if (!isMethodWithBody() && !args.isEmpty()) {
@@ -1017,7 +922,7 @@ class Requester {
* Enum to be transformed
* @return a String containing the value of a Github constant
*/
- private String transformEnum(Enum en) {
+ static String transformEnum(Enum en) {
// by convention Java constant names are upper cases, but github uses
// lower-case constants. GitHub also uses '-', which in Java we always
// replace by '_'
diff --git a/src/main/java/org/kohsuke/github/extras/okhttp3/ObsoleteUrlFactory.java b/src/main/java/org/kohsuke/github/extras/okhttp3/ObsoleteUrlFactory.java
index 39fca925d..3c453ed11 100644
--- a/src/main/java/org/kohsuke/github/extras/okhttp3/ObsoleteUrlFactory.java
+++ b/src/main/java/org/kohsuke/github/extras/okhttp3/ObsoleteUrlFactory.java
@@ -263,7 +263,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
if (networkResponse == null) {
return response.cacheResponse() == null ? "NONE" : "CACHE " + response.code();
} else {
- return response.cacheResponse() == null ? "NETWORK " + response.code()
+ return response.cacheResponse() == null
+ ? "NETWORK " + response.code()
: "CONDITIONAL_CACHE " + networkResponse.code();
}
}
@@ -414,8 +415,10 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
if (responseHeaders == null) {
Response response = getResponse(true);
Headers headers = response.headers();
- responseHeaders = headers.newBuilder().add(SELECTED_PROTOCOL, response.protocol().toString())
- .add(RESPONSE_SOURCE, responseSourceHeader(response)).build();
+ responseHeaders = headers.newBuilder()
+ .add(SELECTED_PROTOCOL, response.protocol().toString())
+ .add(RESPONSE_SOURCE, responseSourceHeader(response))
+ .build();
}
return responseHeaders;
}
@@ -471,7 +474,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
return toMultimap(requestHeaders.build(), null);
}
- @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "Good request will have body")
+ @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
+ justification = "Good request will have body")
@Override
public InputStream getInputStream() throws IOException {
if (!doInput) {
@@ -503,7 +507,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
return requestBody.outputStream;
}
- @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "usingProxy() handles this")
+ @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
+ justification = "usingProxy() handles this")
@Override
public Permission getPermission() {
URL url = getURL();
@@ -604,7 +609,9 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
throw malformedUrl;
}
- Request request = new Request.Builder().url(url).headers(requestHeaders.build()).method(method, requestBody)
+ Request request = new Request.Builder().url(url)
+ .headers(requestHeaders.build())
+ .method(method, requestBody)
.build();
OkHttpClient.Builder clientBuilder = client.newBuilder();
@@ -787,7 +794,8 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
}
}
- @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE", justification = "If we get here there is a connection and request.body() is checked")
+ @SuppressFBWarnings(value = "NP_NULL_ON_SOME_PATH_FROM_RETURN_VALUE",
+ justification = "If we get here there is a connection and request.body() is checked")
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
@@ -843,7 +851,7 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
@Override
public void write(int b) throws IOException {
- write(new byte[] { (byte) b }, 0, 1);
+ write(new byte[]{ (byte) b }, 0, 1);
}
@Override
@@ -929,8 +937,10 @@ public final class ObsoleteUrlFactory implements URLStreamHandlerFactory, Clonea
outputStream.close();
contentLength = buffer.size();
- return request.newBuilder().removeHeader("Transfer-Encoding")
- .header("Content-Length", Long.toString(buffer.size())).build();
+ return request.newBuilder()
+ .removeHeader("Transfer-Encoding")
+ .header("Content-Length", Long.toString(buffer.size()))
+ .build();
}
@Override
diff --git a/src/main/resources/eclipse/formatter.xml b/src/main/resources/eclipse/formatter.xml
new file mode 100644
index 000000000..2e5dcc607
--- /dev/null
+++ b/src/main/resources/eclipse/formatter.xml
@@ -0,0 +1,383 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java
index 39abf6a36..966057c8e 100644
--- a/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java
+++ b/src/test/java/org/kohsuke/github/AbstractGitHubWireMockTest.java
@@ -165,9 +165,12 @@ public abstract class AbstractGitHubWireMockTest extends Assert {
if (mockGitHub.isUseProxy()) {
cleanupRepository(fullName);
- GHRepository repository = gitHubBeforeAfter.getOrganization(GITHUB_API_TEST_ORG).createRepository(name)
+ GHRepository repository = gitHubBeforeAfter.getOrganization(GITHUB_API_TEST_ORG)
+ .createRepository(name)
.description("A test repository for testing the github-api project: " + name)
- .homepage("http://github-api.kohsuke.org/").autoInit(true).create();
+ .homepage("http://github-api.kohsuke.org/")
+ .autoInit(true)
+ .create();
try {
Thread.sleep(3000);
} catch (InterruptedException e) {
diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java
index 6fba815f7..64edd8728 100755
--- a/src/test/java/org/kohsuke/github/AppTest.java
+++ b/src/test/java/org/kohsuke/github/AppTest.java
@@ -34,8 +34,10 @@ public class AppTest extends AbstractGitHubWireMockTest {
cleanupUserRepository("github-api-test-rename");
cleanupUserRepository(targetName);
- GHRepository r = gitHub.createRepository("github-api-test-rename", "a test repository",
- "http://github-api.kohsuke.org/", true);
+ GHRepository r = gitHub.createRepository("github-api-test-rename",
+ "a test repository",
+ "http://github-api.kohsuke.org/",
+ true);
assertThat(r.hasIssues(), is(true));
r.enableIssueTracker(false);
@@ -49,8 +51,11 @@ public class AppTest extends AbstractGitHubWireMockTest {
public void testRepositoryWithAutoInitializationCRUD() throws Exception {
String name = "github-api-test-autoinit";
cleanupUserRepository(name);
- GHRepository r = gitHub.createRepository(name).description("a test repository for auto init")
- .homepage("http://github-api.kohsuke.org/").autoInit(true).create();
+ GHRepository r = gitHub.createRepository(name)
+ .description("a test repository for auto init")
+ .homepage("http://github-api.kohsuke.org/")
+ .autoInit(true)
+ .create();
r.enableIssueTracker(false);
r.enableDownloads(false);
r.enableWiki(false);
@@ -91,8 +96,13 @@ public class AppTest extends AbstractGitHubWireMockTest {
GHUser u = getUser();
GHRepository repository = getTestRepository();
GHMilestone milestone = repository.createMilestone("Test Milestone Title3", "Test Milestone");
- GHIssue o = repository.createIssue("testing").body("this is body").assignee(u).label("bug").label("question")
- .milestone(milestone).create();
+ GHIssue o = repository.createIssue("testing")
+ .body("this is body")
+ .assignee(u)
+ .label("bug")
+ .label("question")
+ .milestone(milestone)
+ .create();
assertNotNull(o);
o.close();
}
@@ -101,7 +111,9 @@ public class AppTest extends AbstractGitHubWireMockTest {
public void testCreateAndListDeployments() throws IOException {
GHRepository repository = getTestRepository();
GHDeployment deployment = repository.createDeployment("master")
- .payload("{\"user\":\"atmos\",\"room_id\":123456}").description("question").environment("unittest")
+ .payload("{\"user\":\"atmos\",\"room_id\":123456}")
+ .description("question")
+ .environment("unittest")
.create();
assertNotNull(deployment.getCreator());
assertNotNull(deployment.getId());
@@ -117,10 +129,14 @@ public class AppTest extends AbstractGitHubWireMockTest {
@Test
public void testGetDeploymentStatuses() throws IOException {
GHRepository repository = getTestRepository();
- GHDeployment deployment = repository.createDeployment("master").description("question")
- .payload("{\"user\":\"atmos\",\"room_id\":123456}").create();
+ GHDeployment deployment = repository.createDeployment("master")
+ .description("question")
+ .payload("{\"user\":\"atmos\",\"room_id\":123456}")
+ .create();
GHDeploymentStatus ghDeploymentStatus = deployment.createStatus(GHDeploymentState.SUCCESS)
- .description("success").targetUrl("http://www.github.com").create();
+ .description("success")
+ .targetUrl("http://www.github.com")
+ .create();
Iterable deploymentStatuses = deployment.listStatuses();
assertNotNull(deploymentStatuses);
assertEquals(1, Iterables.size(deploymentStatuses));
@@ -129,7 +145,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
@Test
public void testGetIssues() throws Exception {
- List closedIssues = gitHub.getOrganization("github-api").getRepository("github-api")
+ List closedIssues = gitHub.getOrganization("github-api")
+ .getRepository("github-api")
.getIssues(GHIssueState.CLOSED);
// prior to using PagedIterable GHRepository.getIssues(GHIssueState) would only retrieve 30 issues
assertTrue(closedIssues.size() > 150);
@@ -150,11 +167,20 @@ public class AppTest extends AbstractGitHubWireMockTest {
GHIssue unhomed = null;
GHIssue homed = null;
try {
- unhomed = repository.createIssue("testing").body("this is body").assignee(u).label("bug").label("question")
+ unhomed = repository.createIssue("testing")
+ .body("this is body")
+ .assignee(u)
+ .label("bug")
+ .label("question")
.create();
assertEquals(unhomed.getNumber(), repository.getIssues(GHIssueState.OPEN, null).get(0).getNumber());
- homed = repository.createIssue("testing").body("this is body").assignee(u).label("bug").label("question")
- .milestone(milestone).create();
+ homed = repository.createIssue("testing")
+ .body("this is body")
+ .assignee(u)
+ .label("bug")
+ .label("question")
+ .milestone(milestone)
+ .create();
assertEquals(homed.getNumber(), repository.getIssues(GHIssueState.OPEN, milestone).get(0).getNumber());
} finally {
if (unhomed != null) {
@@ -306,7 +332,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
@Test
public void testMembership() throws Exception {
- Set members = gitHub.getOrganization(GITHUB_API_TEST_ORG).getRepository("jenkins")
+ Set members = gitHub.getOrganization(GITHUB_API_TEST_ORG)
+ .getRepository("jenkins")
.getCollaboratorNames();
// System.out.println(members.contains("kohsuke"));
}
@@ -344,7 +371,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
@Test
public void testCommit() throws Exception {
- GHCommit commit = gitHub.getUser("jenkinsci").getRepository("jenkins")
+ GHCommit commit = gitHub.getUser("jenkinsci")
+ .getRepository("jenkins")
.getCommit("08c1c9970af4d609ae754fbe803e06186e3206f7");
assertEquals(1, commit.getParents().size());
assertEquals(1, commit.getFiles().size());
@@ -374,8 +402,13 @@ public class AppTest extends AbstractGitHubWireMockTest {
public void testQueryCommits() throws Exception {
List sha1 = new ArrayList();
- for (GHCommit c : gitHub.getUser("jenkinsci").getRepository("jenkins").queryCommits()
- .since(new Date(1199174400000L)).until(1201852800000L).path("pom.xml").list()) {
+ for (GHCommit c : gitHub.getUser("jenkinsci")
+ .getRepository("jenkins")
+ .queryCommits()
+ .since(new Date(1199174400000L))
+ .until(1201852800000L)
+ .path("pom.xml")
+ .list()) {
// System.out.println(c.getSHA1());
sha1.add(c.getSHA1());
}
@@ -403,7 +436,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
@Test
public void testCreateCommitComment() throws Exception {
- GHCommit commit = gitHub.getUser("kohsuke").getRepository("sandbox-ant")
+ GHCommit commit = gitHub.getUser("kohsuke")
+ .getRepository("sandbox-ant")
.getCommit("8ae38db0ea5837313ab5f39d43a6f73de3bd9000");
GHCommitComment c = commit.createComment("[testing](http://kohsuse.org/)");
// System.out.println(c);
@@ -679,8 +713,8 @@ public class AppTest extends AbstractGitHubWireMockTest {
public void testCommitStatusContext() throws IOException {
GHRepository myRepository = getTestRepository();
GHRef masterRef = myRepository.getRef("heads/master");
- GHCommitStatus commitStatus = myRepository.createCommitStatus(masterRef.getObject().getSha(),
- GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
+ GHCommitStatus commitStatus = myRepository.createCommitStatus(masterRef.getObject()
+ .getSha(), GHCommitState.SUCCESS, "http://www.example.com", "test", "test/context");
assertEquals("test/context", commitStatus.getContext());
}
diff --git a/src/test/java/org/kohsuke/github/GHRateLimitTest.java b/src/test/java/org/kohsuke/github/GHRateLimitTest.java
index 9ad89e7cb..bf7e49f1a 100644
--- a/src/test/java/org/kohsuke/github/GHRateLimitTest.java
+++ b/src/test/java/org/kohsuke/github/GHRateLimitTest.java
@@ -336,15 +336,18 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
rateLimit = gitHub.rateLimit();
assertThat(rateLimit, notNullValue());
- assertThat("rateLimit() selects header instance when not expired, does not ask server", rateLimit,
+ assertThat("rateLimit() selects header instance when not expired, does not ask server",
+ rateLimit,
sameInstance(headerRateLimit));
// Nothing changes still valid
Thread.sleep(1000);
- assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.rateLimit(),
+ assertThat("rateLimit() selects header instance when not expired, does not ask server",
+ gitHub.rateLimit(),
sameInstance(headerRateLimit));
- assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.lastRateLimit(),
+ assertThat("rateLimit() selects header instance when not expired, does not ask server",
+ gitHub.lastRateLimit(),
sameInstance(headerRateLimit));
assertThat(mockGitHub.getRequestCount(), equalTo(1));
@@ -355,12 +358,15 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
assertThat("Header instance has expired", gitHub.lastRateLimit().isExpired(), is(true));
assertThat("rateLimit() will ask server when header instance expires and it has not called getRateLimit() yet",
- gitHub.rateLimit(), not(sameInstance(rateLimit)));
+ gitHub.rateLimit(),
+ not(sameInstance(rateLimit)));
assertThat("lastRateLimit() (header instance) is populated as part of internal call to getRateLimit()",
- gitHub.lastRateLimit(), not(sameInstance(rateLimit)));
+ gitHub.lastRateLimit(),
+ not(sameInstance(rateLimit)));
- assertThat("After request, rateLimit() selects header instance since it has been refreshed", gitHub.rateLimit(),
+ assertThat("After request, rateLimit() selects header instance since it has been refreshed",
+ gitHub.rateLimit(),
sameInstance(gitHub.lastRateLimit()));
headerRateLimit = gitHub.lastRateLimit();
@@ -375,10 +381,12 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
// Using custom data to have a header instance that expires before the queried instance
assertThat(
"if header instance expires but queried instance is valid, ratelimit() uses it without asking server",
- gitHub.rateLimit(), not(sameInstance(gitHub.lastRateLimit())));
+ gitHub.rateLimit(),
+ not(sameInstance(gitHub.lastRateLimit())));
assertThat("ratelimit() should almost never return a return a GHRateLimit that is already expired",
- gitHub.rateLimit().isExpired(), is(false));
+ gitHub.rateLimit().isExpired(),
+ is(false));
assertThat("Header instance hasn't been reloaded", gitHub.lastRateLimit(), sameInstance(headerRateLimit));
assertThat("Header instance has expired", gitHub.lastRateLimit().isExpired(), is(true));
@@ -390,12 +398,15 @@ public class GHRateLimitTest extends AbstractGitHubWireMockTest {
headerRateLimit = gitHub.rateLimit();
- assertThat("rateLimit() has asked server for new information", gitHub.rateLimit(),
+ assertThat("rateLimit() has asked server for new information",
+ gitHub.rateLimit(),
not(sameInstance(rateLimit)));
- assertThat("rateLimit() has asked server for new information", gitHub.lastRateLimit(),
+ assertThat("rateLimit() has asked server for new information",
+ gitHub.lastRateLimit(),
not(sameInstance(rateLimit)));
- assertThat("rateLimit() selects header instance when not expired, does not ask server", gitHub.rateLimit(),
+ assertThat("rateLimit() selects header instance when not expired, does not ask server",
+ gitHub.rateLimit(),
sameInstance((gitHub.lastRateLimit())));
assertThat(mockGitHub.getRequestCount(), equalTo(3));
diff --git a/src/test/java/org/kohsuke/github/GistTest.java b/src/test/java/org/kohsuke/github/GistTest.java
index b2987f4f1..ed11bc528 100644
--- a/src/test/java/org/kohsuke/github/GistTest.java
+++ b/src/test/java/org/kohsuke/github/GistTest.java
@@ -15,8 +15,12 @@ public class GistTest extends AbstractGitHubWireMockTest {
@Test
public void lifecycleTest() throws Exception {
// CRUD operation
- GHGist gist = gitHub.createGist().public_(false).description("Test Gist").file("abc.txt", "abc")
- .file("def.txt", "def").create();
+ GHGist gist = gitHub.createGist()
+ .public_(false)
+ .description("Test Gist")
+ .file("abc.txt", "abc")
+ .file("def.txt", "def")
+ .create();
assertThat(gist.getCreatedAt(), is(notNullValue()));
diff --git a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java
index 6f5c7b715..5e244da3b 100644
--- a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java
+++ b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java
@@ -78,8 +78,8 @@ public class GitHubConnectionTest extends AbstractGitHubWireMockTest {
setupEnvironment(props);
- GitHubBuilder builder = GitHubBuilder.fromEnvironment("customLogin", "customPassword", "customOauth",
- "customEndpoint");
+ GitHubBuilder builder = GitHubBuilder
+ .fromEnvironment("customLogin", "customPassword", "customOauth", "customEndpoint");
assertEquals("bogusLogin", builder.user);
assertEquals("bogusOauth", builder.oauthToken);
diff --git a/src/test/java/org/kohsuke/github/GitHubStaticTest.java b/src/test/java/org/kohsuke/github/GitHubStaticTest.java
index 101b04646..83bed2f04 100644
--- a/src/test/java/org/kohsuke/github/GitHubStaticTest.java
+++ b/src/test/java/org/kohsuke/github/GitHubStaticTest.java
@@ -98,7 +98,8 @@ public class GitHubStaticTest extends Assert {
assertThat("Unknown should not replace worst record", GitHub.shouldReplace(unknown1, recordWorst), is(false));
assertThat("Earlier record should replace later worst", GitHub.shouldReplace(record0, recordWorst), is(true));
- assertThat("Later worst record should not replace earlier", GitHub.shouldReplace(recordWorst, record0),
+ assertThat("Later worst record should not replace earlier",
+ GitHub.shouldReplace(recordWorst, record0),
is(false));
assertThat("Equivalent record should not replace", GitHub.shouldReplace(record0, record00), is(false));
@@ -109,14 +110,17 @@ public class GitHubStaticTest extends Assert {
assertThat("Higher limit record should not replace lower", GitHub.shouldReplace(record1, record2), is(false));
- assertThat("Higher limit record with later reset should replace lower", GitHub.shouldReplace(record3, record2),
+ assertThat("Higher limit record with later reset should replace lower",
+ GitHub.shouldReplace(record3, record2),
is(true));
- assertThat("Lower limit record with later reset should replace higher", GitHub.shouldReplace(record4, record1),
+ assertThat("Lower limit record with later reset should replace higher",
+ GitHub.shouldReplace(record4, record1),
is(true));
assertThat("Lower limit record with earlier reset should not replace higher",
- GitHub.shouldReplace(record2, record4), is(false));
+ GitHub.shouldReplace(record2, record4),
+ is(false));
}
diff --git a/src/test/java/org/kohsuke/github/GitHubTest.java b/src/test/java/org/kohsuke/github/GitHubTest.java
index 81cfeba27..f89d1faa5 100644
--- a/src/test/java/org/kohsuke/github/GitHubTest.java
+++ b/src/test/java/org/kohsuke/github/GitHubTest.java
@@ -56,8 +56,12 @@ public class GitHubTest extends AbstractGitHubWireMockTest {
@Test
public void searchContent() throws Exception {
- PagedSearchIterable r = gitHub.searchContent().q("addClass").in("file").language("js")
- .repo("jquery/jquery").list();
+ PagedSearchIterable r = gitHub.searchContent()
+ .q("addClass")
+ .in("file")
+ .language("js")
+ .repo("jquery/jquery")
+ .list();
GHContent c = r.iterator().next();
// System.out.println(c.getName());
assertNotNull(c.getDownloadUrl());
@@ -87,13 +91,13 @@ public class GitHubTest extends AbstractGitHubWireMockTest {
assertEquals(19, meta.getWeb().size());
// Also test examples here
- Class[] examples = new Class[] { ReadOnlyObjects.GHMetaPublic.class, ReadOnlyObjects.GHMetaPackage.class,
+ Class[] examples = new Class[]{ ReadOnlyObjects.GHMetaPublic.class, ReadOnlyObjects.GHMetaPackage.class,
ReadOnlyObjects.GHMetaGettersUnmodifiable.class, ReadOnlyObjects.GHMetaGettersFinal.class,
ReadOnlyObjects.GHMetaGettersFinalCreator.class, };
for (Class metaClass : examples) {
- ReadOnlyObjects.GHMetaExample metaExample = gitHub.retrieve().to("/meta",
- (Class) metaClass);
+ ReadOnlyObjects.GHMetaExample metaExample = gitHub.retrieve()
+ .to("/meta", (Class) metaClass);
assertTrue(metaExample.isVerifiablePasswordAuthentication());
assertEquals(19, metaExample.getApi().size());
assertEquals(19, metaExample.getGit().size());
diff --git a/src/test/java/org/kohsuke/github/Github2faTest.java b/src/test/java/org/kohsuke/github/Github2faTest.java
index fe20355b1..7681a5068 100644
--- a/src/test/java/org/kohsuke/github/Github2faTest.java
+++ b/src/test/java/org/kohsuke/github/Github2faTest.java
@@ -15,13 +15,13 @@ public class Github2faTest extends AbstractGitHubWireMockTest {
public void test2faToken() throws IOException {
assertFalse("Test only valid when not proxying", mockGitHub.isUseProxy());
- List asList = Arrays.asList("repo", "gist", "write:packages", "read:packages", "delete:packages",
- "user", "delete_repo");
+ List asList = Arrays
+ .asList("repo", "gist", "write:packages", "read:packages", "delete:packages", "user", "delete_repo");
String nameOfToken = "Test2faTokenCreate";// +timestamp;// use time stamp to ensure the token creations do not
// collide with older tokens
- GHAuthorization token = gitHub.createToken(asList, nameOfToken, "this is a test token created by a unit test",
- () -> {
+ GHAuthorization token = gitHub
+ .createToken(asList, nameOfToken, "this is a test token created by a unit test", () -> {
String data = "111878";
// TO UPDATE run this in debugger mode, put a breakpoint here, and enter the OTP you get into the
// value of Data
diff --git a/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java b/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java
index d0eac990d..c9bdda95e 100644
--- a/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java
+++ b/src/test/java/org/kohsuke/github/extras/OkHttpConnectorTest.java
@@ -104,7 +104,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
OkHttpClient client = createClient(false);
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client));
- this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
+ this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withConnector(connector)
.build();
doTestActions();
@@ -129,7 +130,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
OkHttpClient client = createClient(true);
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client), -1);
- this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
+ this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withConnector(connector)
.build();
doTestActions();
@@ -159,7 +161,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
OkHttpClient client = createClient(true);
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client), 3);
- this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
+ this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withConnector(connector)
.build();
doTestActions();
@@ -184,7 +187,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
OkHttpClient client = createClient(true);
OkHttpConnector connector = new OkHttpConnector(new OkUrlFactory(client));
- this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl()).withConnector(connector)
+ this.gitHub = getGitHubBuilder().withEndpoint(mockGitHub.apiServer().baseUrl())
+ .withConnector(connector)
.build();
doTestActions();
@@ -204,7 +208,8 @@ public class OkHttpConnectorTest extends AbstractGitHubWireMockTest {
assertThat("Request Count", mockGitHub.getRequestCount(), is(networkRequestCount + userRequestCount));
// Rate limit must be under this value, but if it wiggles we don't care
- assertThat("Rate Limit Change", rateLimitBefore.remaining - rateLimitAfter.remaining,
+ assertThat("Rate Limit Change",
+ rateLimitBefore.remaining - rateLimitAfter.remaining,
is(lessThanOrEqualTo(rateLimitUsed + userRequestCount)));
}