diff --git a/pom.xml b/pom.xml index 2b1b0b0e25..b28166f9d3 100644 --- a/pom.xml +++ b/pom.xml @@ -383,16 +383,8 @@ japicmp-maven-plugin 0.23.0 - - - ${project.groupId} - ${project.artifactId} - 2.0.0-alpha-1 - jar - - - true --> + true true true diff --git a/src/main/java/org/kohsuke/github/GHAppInstallationToken.java b/src/main/java/org/kohsuke/github/GHAppInstallationToken.java index f69144bbd4..817156a4bc 100644 --- a/src/main/java/org/kohsuke/github/GHAppInstallationToken.java +++ b/src/main/java/org/kohsuke/github/GHAppInstallationToken.java @@ -1,6 +1,5 @@ package org.kohsuke.github; -import java.io.IOException; import java.util.*; // TODO: Auto-generated Javadoc @@ -66,10 +65,8 @@ public GHRepositorySelection getRepositorySelection() { * Gets expires at. * * @return date when this token expires - * @throws IOException - * on error */ - public Date getExpiresAt() throws IOException { + public Date getExpiresAt() { return GitHubClient.parseDate(expires_at); } } diff --git a/src/main/java/org/kohsuke/github/GHBranch.java b/src/main/java/org/kohsuke/github/GHBranch.java index f803c67e70..99335c1225 100644 --- a/src/main/java/org/kohsuke/github/GHBranch.java +++ b/src/main/java/org/kohsuke/github/GHBranch.java @@ -34,11 +34,9 @@ public class GHBranch extends GitHubInteractiveObject { * * @param name * the name - * @throws Exception - * the exception */ @JsonCreator - GHBranch(@JsonProperty(value = "name", required = true) String name) throws Exception { + GHBranch(@JsonProperty(value = "name", required = true) String name) { Objects.requireNonNull(name); this.name = name; } diff --git a/src/main/java/org/kohsuke/github/GHCommit.java b/src/main/java/org/kohsuke/github/GHCommit.java index c1d987483a..83ea3be00b 100644 --- a/src/main/java/org/kohsuke/github/GHCommit.java +++ b/src/main/java/org/kohsuke/github/GHCommit.java @@ -520,10 +520,8 @@ public PagedIterable listPullRequests() { * Retrieves a list of branches where this commit is the head commit. * * @return {@link PagedIterable} with the branches where the commit is the head commit - * @throws IOException - * the io exception */ - public PagedIterable listBranchesWhereHead() throws IOException { + public PagedIterable listBranchesWhereHead() { return owner.root() .createRequest() .withUrlPath(String.format("/repos/%s/%s/commits/%s/branches-where-head", diff --git a/src/main/java/org/kohsuke/github/GHCommitPointer.java b/src/main/java/org/kohsuke/github/GHCommitPointer.java index f56c214a50..a466239729 100644 --- a/src/main/java/org/kohsuke/github/GHCommitPointer.java +++ b/src/main/java/org/kohsuke/github/GHCommitPointer.java @@ -49,11 +49,9 @@ public GHCommitPointer() { * This points to the user who owns the {@link #getRepository()}. * * @return the user - * @throws IOException - * the io exception */ @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") - public GHUser getUser() throws IOException { + public GHUser getUser() { if (user != null) return user.root().intern(user); return user; diff --git a/src/main/java/org/kohsuke/github/GHCommitStatus.java b/src/main/java/org/kohsuke/github/GHCommitStatus.java index 524c4d119a..880b10191b 100644 --- a/src/main/java/org/kohsuke/github/GHCommitStatus.java +++ b/src/main/java/org/kohsuke/github/GHCommitStatus.java @@ -1,7 +1,5 @@ package org.kohsuke.github; -import java.io.IOException; - // TODO: Auto-generated Javadoc /** * Represents a status of a commit. @@ -69,10 +67,8 @@ public String getDescription() { * Gets creator. * * @return the creator - * @throws IOException - * the io exception */ - public GHUser getCreator() throws IOException { + public GHUser getCreator() { return root().intern(creator); } diff --git a/src/main/java/org/kohsuke/github/GHContent.java b/src/main/java/org/kohsuke/github/GHContent.java index 2bfc2a1bcc..b25a786504 100644 --- a/src/main/java/org/kohsuke/github/GHContent.java +++ b/src/main/java/org/kohsuke/github/GHContent.java @@ -257,10 +257,8 @@ protected synchronized void populate() throws IOException { * List immediate children of this directory. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listDirectoryContent() throws IOException { + public PagedIterable listDirectoryContent() { if (!isDirectory()) throw new IllegalStateException(path + " is not a directory"); diff --git a/src/main/java/org/kohsuke/github/GHDeployment.java b/src/main/java/org/kohsuke/github/GHDeployment.java index ae18580667..d441fd5a72 100644 --- a/src/main/java/org/kohsuke/github/GHDeployment.java +++ b/src/main/java/org/kohsuke/github/GHDeployment.java @@ -1,6 +1,5 @@ package org.kohsuke.github; -import java.io.IOException; import java.net.URL; import java.util.Collections; import java.util.Map; @@ -169,10 +168,8 @@ public boolean isProductionEnvironment() { * Gets creator. * * @return the creator - * @throws IOException - * the io exception */ - public GHUser getCreator() throws IOException { + public GHUser getCreator() { return root().intern(creator); } diff --git a/src/main/java/org/kohsuke/github/GHDiscussion.java b/src/main/java/org/kohsuke/github/GHDiscussion.java index 94edaacbc8..d2fbaa3f67 100644 --- a/src/main/java/org/kohsuke/github/GHDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHDiscussion.java @@ -36,10 +36,8 @@ public GHDiscussion() { * Gets the html url. * * @return the html url - * @throws IOException - * Signals that an I/O exception has occurred. */ - public URL getHtmlUrl() throws IOException { + public URL getHtmlUrl() { return GitHubClient.parseURL(htmlUrl); } @@ -122,10 +120,8 @@ public boolean isPrivate() { * @param team * the team in which the discussion will be created. * @return a {@link GHLabel.Creator} - * @throws IOException - * the io exception */ - static GHDiscussion.Creator create(GHTeam team) throws IOException { + static GHDiscussion.Creator create(GHTeam team) { return new GHDiscussion.Creator(team); } @@ -154,10 +150,8 @@ static GHDiscussion read(GHTeam team, long discussionNumber) throws IOException * @param team * the team * @return the paged iterable - * @throws IOException - * Signals that an I/O exception has occurred. */ - static PagedIterable readAll(GHTeam team) throws IOException { + static PagedIterable readAll(GHTeam team) { return team.root() .createRequest() .setRawUrlPath(getRawUrlPath(team, null)) diff --git a/src/main/java/org/kohsuke/github/GHEventInfo.java b/src/main/java/org/kohsuke/github/GHEventInfo.java index 551b6cb2ed..050b141f31 100644 --- a/src/main/java/org/kohsuke/github/GHEventInfo.java +++ b/src/main/java/org/kohsuke/github/GHEventInfo.java @@ -162,10 +162,8 @@ public GHUser getActor() throws IOException { * Gets actor login. * * @return the login of the actor. - * @throws IOException - * on error */ - public String getActorLogin() throws IOException { + public String getActorLogin() { return actor.getLogin(); } diff --git a/src/main/java/org/kohsuke/github/GHExternalGroup.java b/src/main/java/org/kohsuke/github/GHExternalGroup.java index 01d997b628..50518412e1 100644 --- a/src/main/java/org/kohsuke/github/GHExternalGroup.java +++ b/src/main/java/org/kohsuke/github/GHExternalGroup.java @@ -194,11 +194,9 @@ void wrapUp(final GitHub root) { // auto-wrapUp when organization is known from * Gets organization. * * @return the organization - * @throws IOException - * the io exception */ @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") - public GHOrganization getOrganization() throws IOException { + public GHOrganization getOrganization() { return organization; } diff --git a/src/main/java/org/kohsuke/github/GHGist.java b/src/main/java/org/kohsuke/github/GHGist.java index d035ee6ef6..1103dd32d0 100644 --- a/src/main/java/org/kohsuke/github/GHGist.java +++ b/src/main/java/org/kohsuke/github/GHGist.java @@ -76,11 +76,9 @@ public String getGistId() { * Gets owner. * * @return User that owns this Gist. - * @throws IOException - * the io exception */ @SuppressFBWarnings(value = { "EI_EXPOSE_REP" }, justification = "Expected behavior") - public GHUser getOwner() throws IOException { + public GHUser getOwner() { return owner; } @@ -265,10 +263,8 @@ public void delete() throws IOException { * Updates this gist via a builder. * * @return the gh gist updater - * @throws IOException - * the io exception */ - public GHGistUpdater update() throws IOException { + public GHGistUpdater update() { return new GHGistUpdater(this); } diff --git a/src/main/java/org/kohsuke/github/GHGistUpdater.java b/src/main/java/org/kohsuke/github/GHGistUpdater.java index 5faaccde4d..8dbd15a479 100644 --- a/src/main/java/org/kohsuke/github/GHGistUpdater.java +++ b/src/main/java/org/kohsuke/github/GHGistUpdater.java @@ -41,10 +41,8 @@ public class GHGistUpdater { * @param content * the content * @return the gh gist updater - * @throws IOException - * the io exception */ - public GHGistUpdater addFile(@Nonnull String fileName, @Nonnull String content) throws IOException { + public GHGistUpdater addFile(@Nonnull String fileName, @Nonnull String content) { updateFile(fileName, content); return this; } @@ -55,10 +53,8 @@ public GHGistUpdater addFile(@Nonnull String fileName, @Nonnull String content) * @param fileName * the file name * @return the GH gist updater - * @throws IOException - * Signals that an I/O exception has occurred. */ - public GHGistUpdater deleteFile(@Nonnull String fileName) throws IOException { + public GHGistUpdater deleteFile(@Nonnull String fileName) { files.put(fileName, null); return this; } @@ -71,10 +67,8 @@ public GHGistUpdater deleteFile(@Nonnull String fileName) throws IOException { * @param newFileName * the new file name * @return the gh gist updater - * @throws IOException - * the io exception */ - public GHGistUpdater renameFile(@Nonnull String fileName, @Nonnull String newFileName) throws IOException { + public GHGistUpdater renameFile(@Nonnull String fileName, @Nonnull String newFileName) { Map file = files.computeIfAbsent(fileName, d -> new HashMap<>()); file.put("filename", newFileName); return this; @@ -88,10 +82,8 @@ public GHGistUpdater renameFile(@Nonnull String fileName, @Nonnull String newFil * @param content * the content * @return the gh gist updater - * @throws IOException - * the io exception */ - public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String content) throws IOException { + public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String content) { Map file = files.computeIfAbsent(fileName, d -> new HashMap<>()); file.put("content", content); return this; @@ -107,11 +99,8 @@ public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String conten * @param content * the content * @return the gh gist updater - * @throws IOException - * the io exception */ - public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String newFileName, @Nonnull String content) - throws IOException { + public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String newFileName, @Nonnull String content) { Map file = files.computeIfAbsent(fileName, d -> new HashMap<>()); file.put("content", content); file.put("filename", newFileName); diff --git a/src/main/java/org/kohsuke/github/GHIssue.java b/src/main/java/org/kohsuke/github/GHIssue.java index 15a7eb883f..4e654c7474 100644 --- a/src/main/java/org/kohsuke/github/GHIssue.java +++ b/src/main/java/org/kohsuke/github/GHIssue.java @@ -539,12 +539,10 @@ public List getComments() throws IOException { * Obtains all the comments associated with this issue, without any filter. * * @return the paged iterable - * @throws IOException - * the io exception * @see List issue comments * @see #queryComments() queryComments to apply filters. */ - public PagedIterable listComments() throws IOException { + public PagedIterable listComments() { return root().createRequest() .withUrlPath(getIssuesApiRoute() + "/comments") .toIterable(GHIssueComment[].class, item -> item.wrapUp(this)); @@ -717,10 +715,8 @@ protected String getIssuesApiRoute() { * Gets assignee. * * @return the assignee - * @throws IOException - * the io exception */ - public GHUser getAssignee() throws IOException { + public GHUser getAssignee() { return root().intern(assignee); } @@ -737,10 +733,8 @@ public List getAssignees() { * User who submitted the issue. * * @return the user - * @throws IOException - * the io exception */ - public GHUser getUser() throws IOException { + public GHUser getUser() { return root().intern(user); } @@ -752,10 +746,8 @@ public GHUser getUser() throws IOException { * https://github.com/kohsuke/github-api/issues/60. * * @return the closed by - * @throws IOException - * the io exception */ - public GHUser getClosedBy() throws IOException { + public GHUser getClosedBy() { if (!"closed".equals(state)) return null; @@ -864,10 +856,8 @@ protected static List getLogins(Collection users) { * Lists events for this issue. See https://developer.github.com/v3/issues/events/ * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listEvents() throws IOException { + public PagedIterable listEvents() { return root().createRequest() .withUrlPath(getRepository().getApiTailUrl(String.format("/issues/%s/events", number))) .toIterable(GHIssueEvent[].class, item -> item.wrapUp(this)); diff --git a/src/main/java/org/kohsuke/github/GHLabel.java b/src/main/java/org/kohsuke/github/GHLabel.java index 6b77b8bfa4..83f1dfa735 100644 --- a/src/main/java/org/kohsuke/github/GHLabel.java +++ b/src/main/java/org/kohsuke/github/GHLabel.java @@ -143,11 +143,9 @@ static Collection toNames(Collection labels) { * @param repository * the repository in which the label will be created. * @return a {@link Creator} - * @throws IOException - * the io exception */ @BetaApi - static Creator create(GHRepository repository) throws IOException { + static Creator create(GHRepository repository) { return new Creator(repository); } @@ -176,10 +174,8 @@ static GHLabel read(@Nonnull GHRepository repository, @Nonnull String name) thro * @param repository * the repository to read from * @return iterable of all labels - * @throws IOException - * the io exception */ - static PagedIterable readAll(@Nonnull final GHRepository repository) throws IOException { + static PagedIterable readAll(@Nonnull final GHRepository repository) { return repository.root() .createRequest() .withUrlPath(repository.getApiTailUrl("labels")) diff --git a/src/main/java/org/kohsuke/github/GHMarketplaceListAccountBuilder.java b/src/main/java/org/kohsuke/github/GHMarketplaceListAccountBuilder.java index 1e061a36c3..745034a8e4 100644 --- a/src/main/java/org/kohsuke/github/GHMarketplaceListAccountBuilder.java +++ b/src/main/java/org/kohsuke/github/GHMarketplaceListAccountBuilder.java @@ -1,7 +1,5 @@ package org.kohsuke.github; -import java.io.IOException; - // TODO: Auto-generated Javadoc /** * Returns any accounts associated with a plan, including free plans. @@ -72,10 +70,8 @@ public enum Sort { * OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint. * * @return a paged iterable instance of GHMarketplaceAccountPlan - * @throws IOException - * on error */ - public PagedIterable createRequest() throws IOException { + public PagedIterable createRequest() { return builder.withUrlPath(String.format("/marketplace_listing/plans/%d/accounts", this.planId)) .toIterable(GHMarketplaceAccountPlan[].class, null); } diff --git a/src/main/java/org/kohsuke/github/GHMilestone.java b/src/main/java/org/kohsuke/github/GHMilestone.java index eeefaf5a9b..3df476bb74 100644 --- a/src/main/java/org/kohsuke/github/GHMilestone.java +++ b/src/main/java/org/kohsuke/github/GHMilestone.java @@ -46,10 +46,8 @@ public GHRepository getOwner() { * Gets creator. * * @return the creator - * @throws IOException - * the io exception */ - public GHUser getCreator() throws IOException { + public GHUser getCreator() { return root().intern(creator); } @@ -68,10 +66,8 @@ public Date getDueOn() { * When was this milestone closed?. * * @return the closed at - * @throws IOException - * the io exception */ - public Date getClosedAt() throws IOException { + public Date getClosedAt() { return GitHubClient.parseDate(closed_at); } diff --git a/src/main/java/org/kohsuke/github/GHMyself.java b/src/main/java/org/kohsuke/github/GHMyself.java index 784f120b15..9d692b65c9 100644 --- a/src/main/java/org/kohsuke/github/GHMyself.java +++ b/src/main/java/org/kohsuke/github/GHMyself.java @@ -162,10 +162,8 @@ public GHPersonSet getAllOrganizations() throws IOException { * Gets the all repositories this user owns (public and private). * * @return the all repositories - * @throws IOException - * the io exception */ - public synchronized Map getAllRepositories() throws IOException { + public synchronized Map getAllRepositories() { Map repositories = new TreeMap(); for (GHRepository r : listRepositories()) { repositories.put(r.getName(), r); diff --git a/src/main/java/org/kohsuke/github/GHOrganization.java b/src/main/java/org/kohsuke/github/GHOrganization.java index 6d0e299330..ec434595aa 100644 --- a/src/main/java/org/kohsuke/github/GHOrganization.java +++ b/src/main/java/org/kohsuke/github/GHOrganization.java @@ -44,10 +44,8 @@ public GHCreateRepositoryBuilder createRepository(String name) { * Teams by their names. * * @return the teams - * @throws IOException - * the io exception */ - public Map getTeams() throws IOException { + public Map getTeams() { Map r = new TreeMap(); for (GHTeam t : listTeams()) { r.put(t.getName(), t); @@ -59,10 +57,8 @@ public Map getTeams() throws IOException { * List up all the teams. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listTeams() throws IOException { + public PagedIterable listTeams() { return root().createRequest() .withUrlPath(String.format("/orgs/%s/teams", login)) .toIterable(GHTeam[].class, item -> item.wrapUp(this)); @@ -91,10 +87,8 @@ public GHTeam getTeam(long teamId) throws IOException { * @param name * the name * @return the team by name - * @throws IOException - * the io exception */ - public GHTeam getTeamByName(String name) throws IOException { + public GHTeam getTeamByName(String name) { for (GHTeam t : listTeams()) { if (t.getName().equals(name)) return t; @@ -123,12 +117,10 @@ public GHTeam getTeamBySlug(String slug) throws IOException { * List up all the external groups. * * @return the paged iterable - * @throws IOException - * the io exception * @see documentation */ - public PagedIterable listExternalGroups() throws IOException { + public PagedIterable listExternalGroups() { return listExternalGroups(null); } @@ -138,12 +130,10 @@ public PagedIterable listExternalGroups() throws IOException { * @param displayName * the text that must be part of the returned groups name * @return the paged iterable - * @throws IOException - * the io exception * @see documentation */ - public PagedIterable listExternalGroups(final String displayName) throws IOException { + public PagedIterable listExternalGroups(final String displayName) { final Requester requester = root().createRequest() .withUrlPath(String.format("/orgs/%s/external-groups", login)); if (displayName != null) { @@ -288,10 +278,8 @@ public void publicize(GHUser u) throws IOException { * All the members of this organization. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listMembers() throws IOException { + public PagedIterable listMembers() { return listMembers("members"); } @@ -299,10 +287,8 @@ public PagedIterable listMembers() throws IOException { * All the public members of this organization. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listPublicMembers() throws IOException { + public PagedIterable listPublicMembers() { return listMembers("public_members"); } @@ -310,14 +296,12 @@ public PagedIterable listPublicMembers() throws IOException { * All the outside collaborators of this organization. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listOutsideCollaborators() throws IOException { + public PagedIterable listOutsideCollaborators() { return listMembers("outside_collaborators"); } - private PagedIterable listMembers(String suffix) throws IOException { + private PagedIterable listMembers(String suffix) { return listMembers(suffix, null, null); } @@ -327,10 +311,8 @@ private PagedIterable listMembers(String suffix) throws IOException { * @param filter * the filter * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listMembersWithFilter(String filter) throws IOException { + public PagedIterable listMembersWithFilter(String filter) { return listMembers("members", filter, null); } @@ -340,10 +322,8 @@ public PagedIterable listMembersWithFilter(String filter) throws IOExcep * @param filter * the filter * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listOutsideCollaboratorsWithFilter(String filter) throws IOException { + public PagedIterable listOutsideCollaboratorsWithFilter(String filter) { return listMembers("outside_collaborators", filter, null); } @@ -353,15 +333,12 @@ public PagedIterable listOutsideCollaboratorsWithFilter(String filter) t * @param role * the role * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listMembersWithRole(String role) throws IOException { + public PagedIterable listMembersWithRole(String role) { return listMembers("members", null, role); } - private PagedIterable listMembers(final String suffix, final String filter, String role) - throws IOException { + private PagedIterable listMembers(final String suffix, final String filter, String role) { return root().createRequest() .withUrlPath(String.format("/orgs/%s/%s", login, suffix)) .with("filter", filter) @@ -373,10 +350,8 @@ private PagedIterable listMembers(final String suffix, final String filt * List up all the security managers. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listSecurityManagers() throws IOException { + public PagedIterable listSecurityManagers() { return root().createRequest() .withUrlPath(String.format("/orgs/%s/security-managers", login)) .toIterable(GHTeam[].class, item -> item.wrapUp(this)); @@ -432,10 +407,8 @@ private void edit(String key, Object value) throws IOException { * @param status * The status filter (all, open or closed). * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listProjects(final GHProject.ProjectStateFilter status) throws IOException { + public PagedIterable listProjects(final GHProject.ProjectStateFilter status) { return root().createRequest() .with("state", status) .withUrlPath(String.format("/orgs/%s/projects", login)) @@ -446,10 +419,8 @@ public PagedIterable listProjects(final GHProject.ProjectStateFilter * Returns all open projects for the organization. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listProjects() throws IOException { + public PagedIterable listProjects() { return listProjects(GHProject.ProjectStateFilter.OPEN); } diff --git a/src/main/java/org/kohsuke/github/GHPerson.java b/src/main/java/org/kohsuke/github/GHPerson.java index 1ef07032af..1b87779a6b 100644 --- a/src/main/java/org/kohsuke/github/GHPerson.java +++ b/src/main/java/org/kohsuke/github/GHPerson.java @@ -72,10 +72,8 @@ protected synchronized void populate() throws IOException { * To list your own repositories, including private repositories, use {@link GHMyself#listRepositories()} * * @return the repositories - * @throws IOException - * the io exception */ - public synchronized Map getRepositories() throws IOException { + public synchronized Map getRepositories() { Map repositories = new TreeMap(); for (GHRepository r : listRepositories().withPageSize(100)) { repositories.put(r.getName(), r); diff --git a/src/main/java/org/kohsuke/github/GHProject.java b/src/main/java/org/kohsuke/github/GHProject.java index 3d0ebdd489..38fcf51e90 100644 --- a/src/main/java/org/kohsuke/github/GHProject.java +++ b/src/main/java/org/kohsuke/github/GHProject.java @@ -60,10 +60,8 @@ public GHProject() { * Gets the html url. * * @return the html url - * @throws IOException - * Signals that an I/O exception has occurred. */ - public URL getHtmlUrl() throws IOException { + public URL getHtmlUrl() { return GitHubClient.parseURL(html_url); } @@ -272,10 +270,8 @@ public void delete() throws IOException { * List columns paged iterable. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listColumns() throws IOException { + public PagedIterable listColumns() { final GHProject project = this; return root().createRequest() .withUrlPath(String.format("/projects/%d/columns", getId())) diff --git a/src/main/java/org/kohsuke/github/GHProjectCard.java b/src/main/java/org/kohsuke/github/GHProjectCard.java index ddfba5c152..20a95294a6 100644 --- a/src/main/java/org/kohsuke/github/GHProjectCard.java +++ b/src/main/java/org/kohsuke/github/GHProjectCard.java @@ -33,10 +33,8 @@ public GHProjectCard() { * Gets the html url. * * @return the html url - * @throws IOException - * Signals that an I/O exception has occurred. */ - public URL getHtmlUrl() throws IOException { + public URL getHtmlUrl() { return null; } diff --git a/src/main/java/org/kohsuke/github/GHProjectColumn.java b/src/main/java/org/kohsuke/github/GHProjectColumn.java index 5af7afec7a..e4ca1f5f90 100644 --- a/src/main/java/org/kohsuke/github/GHProjectColumn.java +++ b/src/main/java/org/kohsuke/github/GHProjectColumn.java @@ -124,10 +124,8 @@ public void delete() throws IOException { * List cards paged iterable. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listCards() throws IOException { + public PagedIterable listCards() { final GHProjectColumn column = this; return root().createRequest() .withUrlPath(String.format("/projects/columns/%d/cards", getId())) diff --git a/src/main/java/org/kohsuke/github/GHProjectsV2Item.java b/src/main/java/org/kohsuke/github/GHProjectsV2Item.java index 43d0224489..30e0424d1c 100644 --- a/src/main/java/org/kohsuke/github/GHProjectsV2Item.java +++ b/src/main/java/org/kohsuke/github/GHProjectsV2Item.java @@ -2,7 +2,6 @@ import org.kohsuke.github.internal.EnumUtils; -import java.io.IOException; import java.net.URL; import java.util.Date; @@ -67,10 +66,8 @@ public ContentType getContentType() { * Gets the creator. * * @return the creator - * @throws IOException - * Signals that an I/O exception has occurred. */ - public GHUser getCreator() throws IOException { + public GHUser getCreator() { return root().intern(creator); } diff --git a/src/main/java/org/kohsuke/github/GHPullRequest.java b/src/main/java/org/kohsuke/github/GHPullRequest.java index a355b07a12..128f819d5b 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequest.java +++ b/src/main/java/org/kohsuke/github/GHPullRequest.java @@ -436,10 +436,8 @@ public PagedIterable listReviews() { * Obtains all the review comments associated with this pull request. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listReviewComments() throws IOException { + public PagedIterable listReviewComments() { return root().createRequest() .withUrlPath(getApiRoute() + COMMENTS_ACTION) .toIterable(GHPullRequestReviewComment[].class, item -> item.wrapUp(this)); diff --git a/src/main/java/org/kohsuke/github/GHPullRequestReview.java b/src/main/java/org/kohsuke/github/GHPullRequestReview.java index be5bbdc062..6c97354dfd 100644 --- a/src/main/java/org/kohsuke/github/GHPullRequestReview.java +++ b/src/main/java/org/kohsuke/github/GHPullRequestReview.java @@ -143,10 +143,8 @@ protected String getApiRoute() { * When was this resource created?. * * @return the submitted at - * @throws IOException - * the io exception */ - public Date getSubmittedAt() throws IOException { + public Date getSubmittedAt() { return GitHubClient.parseDate(submitted_at); } @@ -216,10 +214,8 @@ public void dismiss(String message) throws IOException { * Obtains all the review comments associated with this pull request review. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listReviewComments() throws IOException { + public PagedIterable listReviewComments() { return owner.root() .createRequest() .withUrlPath(getApiRoute() + "/comments") diff --git a/src/main/java/org/kohsuke/github/GHRef.java b/src/main/java/org/kohsuke/github/GHRef.java index 4db5e1c67b..b85c650e2d 100644 --- a/src/main/java/org/kohsuke/github/GHRef.java +++ b/src/main/java/org/kohsuke/github/GHRef.java @@ -145,10 +145,8 @@ static GHRef read(GHRepository repository, String refName) throws IOException { * @param refType * the type of reg to search for e.g. tags or commits * @return paged iterable of all refs of the specified type - * @throws IOException - * on failure communicating with GitHub, potentially due to an invalid ref type being requested */ - static PagedIterable readMatching(GHRepository repository, String refType) throws IOException { + static PagedIterable readMatching(GHRepository repository, String refType) { if (refType.startsWith("refs/")) { refType = refType.replaceFirst("refs/", ""); } diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index 2916d8fac5..e96c813e48 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -504,10 +504,8 @@ public GHRelease getLatestRelease() throws IOException { * List releases paged iterable. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listReleases() throws IOException { + public PagedIterable listReleases() { return root().createRequest() .withUrlPath(getApiTailUrl("releases")) .toIterable(GHRelease[].class, item -> item.wrap(this)); @@ -517,10 +515,8 @@ public PagedIterable listReleases() throws IOException { * List tags paged iterable. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listTags() throws IOException { + public PagedIterable listTags() { return root().createRequest() .withUrlPath(getApiTailUrl("tags")) .toIterable(GHTag[].class, item -> item.wrap(this)); @@ -879,10 +875,8 @@ public GHPersonSet getCollaborators() throws IOException { * Lists up the collaborators on this repository. * * @return Users paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listCollaborators() throws IOException { + public PagedIterable listCollaborators() { return listUsers("collaborators"); } @@ -892,10 +886,8 @@ public PagedIterable listCollaborators() throws IOException { * @param affiliation * Filter users by affiliation * @return Users paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listCollaborators(CollaboratorAffiliation affiliation) throws IOException { + public PagedIterable listCollaborators(CollaboratorAffiliation affiliation) { return listUsers(root().createRequest().with("affiliation", affiliation), "collaborators"); } @@ -905,10 +897,8 @@ public PagedIterable listCollaborators(CollaboratorAffiliation affiliati * available assignees to which issues may be assigned. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listAssignees() throws IOException { + public PagedIterable listAssignees() { return listUsers("assignees"); } @@ -1752,10 +1742,8 @@ public GHRef[] getRefs() throws IOException { * Retrieves all refs for the github repository. * * @return paged iterable of all refs - * @throws IOException - * on failure communicating with GitHub, potentially due to an invalid ref type being requested */ - public PagedIterable listRefs() throws IOException { + public PagedIterable listRefs() { return listRefs(""); } @@ -1778,10 +1766,8 @@ public GHRef[] getRefs(String refType) throws IOException { * @param refType * the type of reg to search for e.g. tags or commits * @return paged iterable of all refs of the specified type - * @throws IOException - * on failure communicating with GitHub, potentially due to an invalid ref type being requested */ - public PagedIterable listRefs(String refType) throws IOException { + public PagedIterable listRefs(String refType) { return GHRef.readMatching(this, refType); } @@ -2016,10 +2002,8 @@ private GHContentWithLicense getLicenseContent_() throws IOException { * @param sha1 * the sha 1 * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listCommitStatuses(final String sha1) throws IOException { + public PagedIterable listCommitStatuses(final String sha1) { return root().createRequest() .withUrlPath(String.format("/repos/%s/%s/statuses/%s", getOwnerName(), name, sha1)) .toIterable(GHCommitStatus[].class, null); @@ -2045,12 +2029,10 @@ public GHCommitStatus getLastCommitStatus(String sha1) throws IOException { * @param ref * ref * @return check runs for given ref - * @throws IOException - * the io exception * @see List check runs * for a specific ref */ - public PagedIterable getCheckRuns(String ref) throws IOException { + public PagedIterable getCheckRuns(String ref) { GitHubRequest request = root().createRequest() .withUrlPath(String.format("/repos/%s/%s/commits/%s/check-runs", getOwnerName(), name, ref)) .build(); @@ -2065,12 +2047,10 @@ public PagedIterable getCheckRuns(String ref) throws IOException { * @param params * a map of parameters to filter check runs * @return check runs for the given ref - * @throws IOException - * the io exception * @see List check runs * for a specific ref */ - public PagedIterable getCheckRuns(String ref, Map params) throws IOException { + public PagedIterable getCheckRuns(String ref, Map params) { GitHubRequest request = root().createRequest() .withUrlPath(String.format("/repos/%s/%s/commits/%s/check-runs", getOwnerName(), name, ref)) .with(params) @@ -2160,10 +2140,8 @@ public GHCommitStatus createCommitStatus(String sha1, GHCommitState state, Strin * Lists repository events. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listEvents() throws IOException { + public PagedIterable listEvents() { return root().createRequest() .withUrlPath(String.format("/repos/%s/%s/events", getOwnerName(), name)) .toIterable(GHEventInfo[].class, null); @@ -2175,10 +2153,8 @@ public PagedIterable listEvents() throws IOException { * https://developer.github.com/v3/issues/labels/#list-all-labels-for-this-repository * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listLabels() throws IOException { + public PagedIterable listLabels() { return GHLabel.readAll(this); } @@ -2690,10 +2666,8 @@ public List listCodeownersErrors() throws IOException { * List contributors paged iterable. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listContributors() throws IOException { + public PagedIterable listContributors() { return listContributors(null); } @@ -2703,12 +2677,10 @@ public PagedIterable listContributors() throws IOException { * @param includeAnonymous * whether to include anonymous contributors * @return the paged iterable - * @throws IOException - * the io exception * @see * GitHub API - List Repository Contributors */ - public PagedIterable listContributors(Boolean includeAnonymous) throws IOException { + public PagedIterable listContributors(Boolean includeAnonymous) { return root().createRequest() .withUrlPath(getApiTailUrl("contributors")) .with("anon", includeAnonymous) @@ -2800,10 +2772,8 @@ public GHProject createProject(String name, String body) throws IOException { * @param status * The status filter (all, open or closed). * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listProjects(final GHProject.ProjectStateFilter status) throws IOException { + public PagedIterable listProjects(final GHProject.ProjectStateFilter status) { return root().createRequest() .with("state", status) .withUrlPath(getApiTailUrl("projects")) @@ -2927,10 +2897,8 @@ String getApiTailUrl(String tail) { * https://developer.github.com/v3/issues/events/#list-events-for-a-repository * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listIssueEvents() throws IOException { + public PagedIterable listIssueEvents() { return root().createRequest() .withUrlPath(getApiTailUrl("issues/events")) .toIterable(GHIssueEvent[].class, null); @@ -3316,10 +3284,8 @@ public List getTopReferralSources() throw * @param branch * the branch * @return the rules for branch - * @throws IOException - * the io exception */ - public PagedIterable listRulesForBranch(String branch) throws IOException { + public PagedIterable listRulesForBranch(String branch) { return root().createRequest() .method("GET") .withUrlPath(getApiTailUrl("/rules/branches/" + branch)) @@ -3379,10 +3345,8 @@ public GHAutolinkBuilder createAutolink() { * (https://docs.github.com/en/rest/repos/autolinks?apiVersion=2022-11-28#get-all-autolinks-of-a-repository) * * @return all autolinks in the repo - * @throws IOException - * the io exception */ - public PagedIterable listAutolinks() throws IOException { + public PagedIterable listAutolinks() { return root().createRequest() .withHeader("Accept", "application/vnd.github+json") .withUrlPath(String.format("/repos/%s/%s/autolinks", getOwnerName(), getName())) diff --git a/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java b/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java index 2c1bc4b27a..a04f234497 100644 --- a/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java +++ b/src/main/java/org/kohsuke/github/GHRepositoryDiscussion.java @@ -2,7 +2,6 @@ import org.kohsuke.github.internal.EnumUtils; -import java.io.IOException; import java.net.URL; import java.util.Date; @@ -78,10 +77,8 @@ public Date getAnswerChosenAt() { * Gets the answer chosen by. * * @return the answer chosen by - * @throws IOException - * Signals that an I/O exception has occurred. */ - public GHUser getAnswerChosenBy() throws IOException { + public GHUser getAnswerChosenBy() { return root().intern(answerChosenBy); } @@ -116,10 +113,8 @@ public String getTitle() { * Gets the user. * * @return the user - * @throws IOException - * Signals that an I/O exception has occurred. */ - public GHUser getUser() throws IOException { + public GHUser getUser() { return root().intern(user); } diff --git a/src/main/java/org/kohsuke/github/GHRepositoryDiscussionComment.java b/src/main/java/org/kohsuke/github/GHRepositoryDiscussionComment.java index b16f61a98b..327eb036ca 100644 --- a/src/main/java/org/kohsuke/github/GHRepositoryDiscussionComment.java +++ b/src/main/java/org/kohsuke/github/GHRepositoryDiscussionComment.java @@ -1,6 +1,5 @@ package org.kohsuke.github; -import java.io.IOException; import java.net.URL; /** @@ -64,10 +63,8 @@ public int getChildCommentCount() { * Gets the user. * * @return the user - * @throws IOException - * Signals that an I/O exception has occurred. */ - public GHUser getUser() throws IOException { + public GHUser getUser() { return root().intern(user); } diff --git a/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java b/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java index 4de7fbad5f..1b075861f3 100644 --- a/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java +++ b/src/main/java/org/kohsuke/github/GHRepositoryStatistics.java @@ -40,12 +40,10 @@ public GHRepositoryStatistics(GHRepository repo) { * https://developer.github.com/v3/repos/statistics/#get-contributors-list-with-additions-deletions-and-commit-counts * * @return the contributor stats - * @throws IOException - * the io exception * @throws InterruptedException * the interrupted exception */ - public PagedIterable getContributorStats() throws IOException, InterruptedException { + public PagedIterable getContributorStats() throws InterruptedException { return getContributorStats(true); } @@ -55,16 +53,13 @@ public PagedIterable getContributorStats() throws IOException, * @param waitTillReady * Whether to sleep the thread if necessary until the statistics are ready. This is true by default. * @return the contributor stats - * @throws IOException - * the io exception * @throws InterruptedException * the interrupted exception */ @BetaApi @SuppressWarnings("SleepWhileInLoop") @SuppressFBWarnings(value = { "RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE" }, justification = "JSON API") - public PagedIterable getContributorStats(boolean waitTillReady) - throws IOException, InterruptedException { + public PagedIterable getContributorStats(boolean waitTillReady) throws InterruptedException { PagedIterable stats = getContributorStatsImpl(); if (stats == null && waitTillReady) { @@ -84,7 +79,7 @@ public PagedIterable getContributorStats(boolean waitTillReady /** * This gets the actual statistics from the server. Returns null if they are still being cached. */ - private PagedIterable getContributorStatsImpl() throws IOException { + private PagedIterable getContributorStatsImpl() { return root().createRequest() .withUrlPath(getApiTailUrl("contributors")) .toIterable(ContributorStats[].class, null); @@ -242,10 +237,8 @@ public String toString() { * https://developer.github.com/v3/repos/statistics/#get-the-last-year-of-commit-activity-data * * @return the commit activity - * @throws IOException - * the io exception */ - public PagedIterable getCommitActivity() throws IOException { + public PagedIterable getCommitActivity() { return root().createRequest() .withUrlPath(getApiTailUrl("commit_activity")) .toIterable(CommitActivity[].class, null); diff --git a/src/main/java/org/kohsuke/github/GHRepositoryVariable.java b/src/main/java/org/kohsuke/github/GHRepositoryVariable.java index 6a45c6cf98..cbafab9005 100644 --- a/src/main/java/org/kohsuke/github/GHRepositoryVariable.java +++ b/src/main/java/org/kohsuke/github/GHRepositoryVariable.java @@ -115,11 +115,9 @@ static GHRepositoryVariable read(@Nonnull GHRepository repository, @Nonnull Stri * @param repository * the repository in which the variable will be created. * @return a {@link GHRepositoryVariable.Creator} - * @throws IOException - * the io exception */ @BetaApi - static GHRepositoryVariable.Creator create(GHRepository repository) throws IOException { + static GHRepositoryVariable.Creator create(GHRepository repository) { return new GHRepositoryVariable.Creator(repository); } diff --git a/src/main/java/org/kohsuke/github/GHTeam.java b/src/main/java/org/kohsuke/github/GHTeam.java index edba5e7b25..d2c9af1eb7 100644 --- a/src/main/java/org/kohsuke/github/GHTeam.java +++ b/src/main/java/org/kohsuke/github/GHTeam.java @@ -164,11 +164,9 @@ public void setPrivacy(Privacy privacy) throws IOException { * Retrieves the discussions. * * @return the paged iterable - * @throws IOException - * the io exception */ @Nonnull - public PagedIterable listDiscussions() throws IOException { + public PagedIterable listDiscussions() { return GHDiscussion.readAll(this); } @@ -178,10 +176,8 @@ public PagedIterable listDiscussions() throws IOException { * @param role * the role * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listMembers(String role) throws IOException { + public PagedIterable listMembers(String role) { return root().createRequest().withUrlPath(api("/members")).with("role", role).toIterable(GHUser[].class, null); } @@ -191,10 +187,8 @@ public PagedIterable listMembers(String role) throws IOException { * @param role * the role * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listMembers(Role role) throws IOException { + public PagedIterable listMembers(Role role) { return listMembers(transformEnum(role)); } @@ -217,10 +211,8 @@ public GHDiscussion getDiscussion(long discussionNumber) throws IOException { * Retrieves the current members. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listMembers() throws IOException { + public PagedIterable listMembers() { return listMembers("all"); } @@ -228,10 +220,8 @@ public PagedIterable listMembers() throws IOException { * Retrieves the teams that are children of this team. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listChildTeams() throws IOException { + public PagedIterable listChildTeams() { return root().createRequest() .withUrlPath(api("/teams")) .toIterable(GHTeam[].class, item -> item.wrapUp(this.organization)); @@ -268,10 +258,8 @@ public boolean hasMember(GHUser user) { * Gets repositories. * * @return the repositories - * @throws IOException - * the io exception */ - public Map getRepositories() throws IOException { + public Map getRepositories() { Map m = new TreeMap<>(); for (GHRepository r : listRepositories()) { m.put(r.getName(), r); diff --git a/src/main/java/org/kohsuke/github/GHUser.java b/src/main/java/org/kohsuke/github/GHUser.java index fd93a00937..26da5dbc75 100644 --- a/src/main/java/org/kohsuke/github/GHUser.java +++ b/src/main/java/org/kohsuke/github/GHUser.java @@ -244,10 +244,8 @@ public PagedIterable listEvents() throws IOException { * Lists Gists created by this user. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listGists() throws IOException { + public PagedIterable listGists() { return root().createRequest() .withUrlPath(String.format("/users/%s/gists", login)) .toIterable(GHGist[].class, null); diff --git a/src/main/java/org/kohsuke/github/GHWorkflow.java b/src/main/java/org/kohsuke/github/GHWorkflow.java index 522870a9cf..87d7278e80 100644 --- a/src/main/java/org/kohsuke/github/GHWorkflow.java +++ b/src/main/java/org/kohsuke/github/GHWorkflow.java @@ -67,10 +67,8 @@ public String getState() { * Gets the html url. * * @return the html url - * @throws IOException - * Signals that an I/O exception has occurred. */ - public URL getHtmlUrl() throws IOException { + public URL getHtmlUrl() { return GitHubClient.parseURL(htmlUrl); } diff --git a/src/main/java/org/kohsuke/github/GHWorkflowRun.java b/src/main/java/org/kohsuke/github/GHWorkflowRun.java index 4fe8873847..04a431abbd 100644 --- a/src/main/java/org/kohsuke/github/GHWorkflowRun.java +++ b/src/main/java/org/kohsuke/github/GHWorkflowRun.java @@ -113,10 +113,8 @@ public long getRunAttempt() { * When was this run triggered?. * * @return run triggered - * @throws IOException - * on error */ - public Date getRunStartedAt() throws IOException { + public Date getRunStartedAt() { return GitHubClient.parseDate(runStartedAt); } @@ -134,10 +132,8 @@ public GHUser getTriggeringActor() { * Gets the html url. * * @return the html url - * @throws IOException - * Signals that an I/O exception has occurred. */ - public URL getHtmlUrl() throws IOException { + public URL getHtmlUrl() { return GitHubClient.parseURL(htmlUrl); } diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index aa5b6239e3..a7f6605125 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -596,11 +596,9 @@ public GHRepository getRepositoryById(long id) throws IOException { * Returns a list of popular open source licenses. * * @return a list of popular open source licenses - * @throws IOException - * the io exception * @see GitHub API - Licenses */ - public PagedIterable listLicenses() throws IOException { + public PagedIterable listLicenses() { return createRequest().withUrlPath("/licenses").toIterable(GHLicense[].class, null); } @@ -608,10 +606,8 @@ public PagedIterable listLicenses() throws IOException { * Returns a list of all users. * * @return the paged iterable - * @throws IOException - * the io exception */ - public PagedIterable listUsers() throws IOException { + public PagedIterable listUsers() { return createRequest().withUrlPath("/users").toIterable(GHUser[].class, null); } @@ -637,12 +633,10 @@ public GHLicense getLicense(String key) throws IOException { * OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint. * * @return the paged iterable - * @throws IOException - * the io exception * @see List * Plans */ - public PagedIterable listMarketplacePlans() throws IOException { + public PagedIterable listMarketplacePlans() { return createRequest().withUrlPath("/marketplace_listing/plans").toIterable(GHMarketplacePlan[].class, null); } @@ -690,12 +684,10 @@ public Map getMyOrganizations() throws IOException { * OAuth Apps must authenticate using an OAuth token. * * @return the paged iterable of GHMarketplaceUserPurchase - * @throws IOException - * the io exception * @see Get a user's * Marketplace purchases */ - public PagedIterable getMyMarketplacePurchases() throws IOException { + public PagedIterable getMyMarketplacePurchases() { return createRequest().withUrlPath("/user/marketplace_purchases") .toIterable(GHMarketplaceUserPurchase[].class, null); } @@ -993,12 +985,10 @@ public GHAuthorization resetAuth(@Nonnull String clientId, @Nonnull String acces * Returns a list of all authorizations. * * @return the paged iterable - * @throws IOException - * the io exception * @see List your * authorizations */ - public PagedIterable listMyAuthorizations() throws IOException { + public PagedIterable listMyAuthorizations() { return createRequest().withUrlPath("/authorizations").toIterable(GHAuthorization[].class, null); } @@ -1056,11 +1046,9 @@ public GHAppFromManifest createAppFromManifest(@Nonnull String code) throws IOEx * ways of retrieving installations. * * @return the app - * @throws IOException - * the io exception * @see GitHub App installations */ - public GHAuthenticatedAppInstallation getInstallation() throws IOException { + public GHAuthenticatedAppInstallation getInstallation() { return new GHAuthenticatedAppInstallation(this); } @@ -1317,10 +1305,8 @@ Requester createRequest() { * @param user * the user * @return the GH user - * @throws IOException - * Signals that an I/O exception has occurred. */ - GHUser intern(GHUser user) throws IOException { + GHUser intern(GHUser user) { if (user != null) { // if we already have this user in our map, get it // if not, remember this new user diff --git a/src/main/java/org/kohsuke/github/GitHubBuilder.java b/src/main/java/org/kohsuke/github/GitHubBuilder.java index 19f4c4a957..035ad76a6c 100644 --- a/src/main/java/org/kohsuke/github/GitHubBuilder.java +++ b/src/main/java/org/kohsuke/github/GitHubBuilder.java @@ -106,10 +106,8 @@ private static void loadIfSet(String envName, Properties p, String propName) { * See class javadoc for the relationship between these coordinates. * * @return the GitHubBuilder - * @throws IOException - * the io exception */ - public static GitHubBuilder fromEnvironment() throws IOException { + public static GitHubBuilder fromEnvironment() { Properties props = new Properties(); for (Entry e : System.getenv().entrySet()) { String name = e.getKey().toLowerCase(Locale.ENGLISH); diff --git a/src/main/java/org/kohsuke/github/GitHubClient.java b/src/main/java/org/kohsuke/github/GitHubClient.java index 38552b573c..a8cf296935 100644 --- a/src/main/java/org/kohsuke/github/GitHubClient.java +++ b/src/main/java/org/kohsuke/github/GitHubClient.java @@ -111,15 +111,13 @@ class GitHubClient { * the rate limit checker * @param authorizationProvider * the authorization provider - * @throws IOException - * Signals that an I/O exception has occurred. */ GitHubClient(String apiUrl, GitHubConnector connector, GitHubRateLimitHandler rateLimitHandler, GitHubAbuseLimitHandler abuseLimitHandler, GitHubRateLimitChecker rateLimitChecker, - AuthorizationProvider authorizationProvider) throws IOException { + AuthorizationProvider authorizationProvider) { if (apiUrl.endsWith("/")) { apiUrl = apiUrl.substring(0, apiUrl.length() - 1); // normalize @@ -679,7 +677,7 @@ private static boolean shouldIgnoreBody(@Nonnull GitHubConnectorResponse connect */ private static IOException interpretApiError(IOException e, @Nonnull GitHubConnectorRequest connectorRequest, - @CheckForNull GitHubConnectorResponse connectorResponse) throws IOException { + @CheckForNull GitHubConnectorResponse connectorResponse) { // If we're already throwing a GHIOException, pass through if (e instanceof GHIOException) { return e; diff --git a/src/main/java/org/kohsuke/github/GitHubPageIterator.java b/src/main/java/org/kohsuke/github/GitHubPageIterator.java index 4f622d05b4..975a010a90 100644 --- a/src/main/java/org/kohsuke/github/GitHubPageIterator.java +++ b/src/main/java/org/kohsuke/github/GitHubPageIterator.java @@ -1,7 +1,6 @@ package org.kohsuke.github; import java.io.IOException; -import java.net.MalformedURLException; import java.net.URL; import java.util.Iterator; import java.util.NoSuchElementException; @@ -161,8 +160,7 @@ private void fetch() { /** * Locate the next page from the pagination "Link" tag. */ - private GitHubRequest findNextURL(GitHubRequest nextRequest, GitHubResponse nextResponse) - throws MalformedURLException { + private GitHubRequest findNextURL(GitHubRequest nextRequest, GitHubResponse nextResponse) { GitHubRequest result = null; String link = nextResponse.header("Link"); if (link != null) { diff --git a/src/test/java/org/kohsuke/github/AppTest.java b/src/test/java/org/kohsuke/github/AppTest.java index b271dd7ca8..9f98835db3 100755 --- a/src/test/java/org/kohsuke/github/AppTest.java +++ b/src/test/java/org/kohsuke/github/AppTest.java @@ -1058,13 +1058,10 @@ public void testGetEmails() throws IOException { /** * Test app. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ @Ignore("Needs mocking check") @Test - public void testApp() throws IOException { + public void testApp() { // System.out.println(gitHub.getMyself().getEmails()); // GHRepository r = gitHub.getOrganization("jenkinsci").createRepository("kktest4", "Kohsuke's test", @@ -1395,12 +1392,9 @@ public void testCommitSearch() throws IOException { /** * Test issue search. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ @Test - public void testIssueSearch() throws IOException { + public void testIssueSearch() { PagedSearchIterable r = gitHub.searchIssues() .mentions("kohsuke") .isOpen() diff --git a/src/test/java/org/kohsuke/github/BridgeMethodTest.java b/src/test/java/org/kohsuke/github/BridgeMethodTest.java index a4ccdd5d09..a3f25adea8 100644 --- a/src/test/java/org/kohsuke/github/BridgeMethodTest.java +++ b/src/test/java/org/kohsuke/github/BridgeMethodTest.java @@ -3,7 +3,6 @@ import org.junit.Assert; import org.junit.Test; -import java.io.IOException; import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; @@ -28,12 +27,9 @@ public BridgeMethodTest() { /** * Test bridge methods. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ @Test - public void testBridgeMethods() throws IOException { + public void testBridgeMethods() { // Some would say this is redundant, given that bridge methods are so thin anyway // In the interest of maintaining binary compatibility, we'll do this anyway for a sampling of methods diff --git a/src/test/java/org/kohsuke/github/GHAutolinkTest.java b/src/test/java/org/kohsuke/github/GHAutolinkTest.java index 8a09e5b22d..203bf7754a 100644 --- a/src/test/java/org/kohsuke/github/GHAutolinkTest.java +++ b/src/test/java/org/kohsuke/github/GHAutolinkTest.java @@ -184,12 +184,9 @@ public void testDeleteAutolink() throws Exception { /** * Cleanup. - * - * @throws Exception - * the exception */ @After - public void cleanup() throws Exception { + public void cleanup() { if (repo != null) { try { PagedIterable autolinks = repo.listAutolinks(); diff --git a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java index 36151cea4f..719382faed 100644 --- a/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java +++ b/src/test/java/org/kohsuke/github/GHContentIntegrationTest.java @@ -271,10 +271,8 @@ int checkCreatedCommits(GitCommit gitCommit, GHCommit ghCommit, int expectedRequ * @param resp * the resp * @return the GH commit - * @throws Exception - * the exception */ - GHCommit getGHCommit(GHContentUpdateResponse resp) throws Exception { + GHCommit getGHCommit(GHContentUpdateResponse resp) { return resp.getCommit().toGHCommit(); } @@ -325,10 +323,8 @@ int checkUpdatedContentResponseCommits(GitCommit gitCommit, GHCommit ghCommit, i * @param expectedRequestCount * the expected request count * @return the int - * @throws IOException - * Signals that an I/O exception has occurred. */ - int checkBasicCommitInfo(GitCommit gitCommit, GHCommit ghCommit, int expectedRequestCount) throws IOException { + int checkBasicCommitInfo(GitCommit gitCommit, GHCommit ghCommit, int expectedRequestCount) { assertThat(gitCommit, notNullValue()); assertThat(gitCommit.getSHA1(), notNullValue()); assertThat(gitCommit.getUrl().toString(), @@ -417,10 +413,8 @@ int checkCommitTree(GitCommit gitCommit, GHCommit ghCommit, int expectedRequestC * @param expectedRequestCount * the expected request count * @return the int - * @throws IOException - * Signals that an I/O exception has occurred. */ - int checkCommitParents(GitCommit gitCommit, GHCommit ghCommit, int expectedRequestCount) throws IOException { + int checkCommitParents(GitCommit gitCommit, GHCommit ghCommit, int expectedRequestCount) { assertThat(gitCommit.getParentSHA1s().size(), is(greaterThan(0))); assertThat(gitCommit.getParentSHA1s().get(0), notNullValue()); assertThat(ghCommit.getParentSHA1s().size(), is(greaterThan(0))); diff --git a/src/test/java/org/kohsuke/github/GHLicenseTest.java b/src/test/java/org/kohsuke/github/GHLicenseTest.java index 89580309b6..ff63d24241 100644 --- a/src/test/java/org/kohsuke/github/GHLicenseTest.java +++ b/src/test/java/org/kohsuke/github/GHLicenseTest.java @@ -48,12 +48,9 @@ public GHLicenseTest() { /** * Basic test to ensure that the list of licenses from {@link GitHub#listLicenses()} is returned. - * - * @throws IOException - * if test fails */ @Test - public void listLicenses() throws IOException { + public void listLicenses() { Iterable licenses = gitHub.listLicenses(); assertThat(licenses, is(not(emptyIterable()))); } diff --git a/src/test/java/org/kohsuke/github/GHProjectTest.java b/src/test/java/org/kohsuke/github/GHProjectTest.java index 45f893e302..ffef245ca4 100644 --- a/src/test/java/org/kohsuke/github/GHProjectTest.java +++ b/src/test/java/org/kohsuke/github/GHProjectTest.java @@ -38,12 +38,9 @@ public void setUp() throws Exception { /** * Test created project. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ @Test - public void testCreatedProject() throws IOException { + public void testCreatedProject() { assertThat(project, notNullValue()); assertThat(project.getName(), equalTo("test-project")); assertThat(project.getBody(), equalTo("This is a test project")); diff --git a/src/test/java/org/kohsuke/github/GHRepositoryForkBuilderTest.java b/src/test/java/org/kohsuke/github/GHRepositoryForkBuilderTest.java index 2ed56583f5..c045ef811e 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryForkBuilderTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryForkBuilderTest.java @@ -204,12 +204,9 @@ public void testForkChangedName() throws Exception { /** * Test timeout message and sleep count. - * - * @throws Exception - * the exception */ @Test - public void testTimeoutMessage() throws Exception { + public void testTimeoutMessage() { // For re-recording, use line below to create successful fork test copy, then comment it out and modify json // response to 404 // repo.createFork().name("test-message").create(); diff --git a/src/test/java/org/kohsuke/github/GHRepositoryTest.java b/src/test/java/org/kohsuke/github/GHRepositoryTest.java index c81b4f292b..23fd710dbf 100644 --- a/src/test/java/org/kohsuke/github/GHRepositoryTest.java +++ b/src/test/java/org/kohsuke/github/GHRepositoryTest.java @@ -888,12 +888,9 @@ public void listEmptyContributors() throws IOException { /** * Search repositories. - * - * @throws Exception - * the exception */ @Test - public void searchRepositories() throws Exception { + public void searchRepositories() { PagedSearchIterable r = gitHub.searchRepositories() .q("tetris") .language("assembly") @@ -908,12 +905,9 @@ public void searchRepositories() throws Exception { /** * Search org for repositories. - * - * @throws Exception - * the exception */ @Test - public void searchOrgForRepositories() throws Exception { + public void searchOrgForRepositories() { PagedSearchIterable r = gitHub.searchRepositories().org("hub4j-test-org").list(); GHRepository u = r.iterator().next(); assertThat(u.getOwnerName(), equalTo("hub4j-test-org")); @@ -1337,12 +1331,9 @@ public void listRefsHeads() throws Exception { /** * List refs empty tags. - * - * @throws Exception - * the exception */ @Test - public void listRefsEmptyTags() throws Exception { + public void listRefsEmptyTags() { try { GHRepository repo = getTempRepository(); repo.listRefs("tags").toList(); diff --git a/src/test/java/org/kohsuke/github/GHTagTest.java b/src/test/java/org/kohsuke/github/GHTagTest.java index 48f990f3dc..79b42c5648 100644 --- a/src/test/java/org/kohsuke/github/GHTagTest.java +++ b/src/test/java/org/kohsuke/github/GHTagTest.java @@ -24,13 +24,10 @@ public GHTagTest() { /** * Clean up tags. - * - * @throws Exception - * the exception */ @Before @After - public void cleanUpTags() throws Exception { + public void cleanUpTags() { // Cleanup is only needed when proxying if (!mockGitHub.isUseProxy()) { return; diff --git a/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java b/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java index b329857e1e..e3727d7c56 100644 --- a/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java +++ b/src/test/java/org/kohsuke/github/GHWorkflowRunTest.java @@ -709,7 +709,7 @@ private static void checkArtifactProperties(GHArtifact artifact, String artifact assertThat(artifact.isExpired(), is(false)); } - private static void checkJobProperties(long workflowRunId, GHWorkflowJob job, String jobName) throws IOException { + private static void checkJobProperties(long workflowRunId, GHWorkflowJob job, String jobName) { assertThat(job.getId(), notNullValue()); assertThat(job.getNodeId(), notNullValue()); assertThat(job.getRepository().getFullName(), equalTo(REPO_NAME)); diff --git a/src/test/java/org/kohsuke/github/GHWorkflowTest.java b/src/test/java/org/kohsuke/github/GHWorkflowTest.java index 33e3682bbd..be3c1bab9b 100644 --- a/src/test/java/org/kohsuke/github/GHWorkflowTest.java +++ b/src/test/java/org/kohsuke/github/GHWorkflowTest.java @@ -173,7 +173,7 @@ public void testListWorkflowRuns() throws IOException { checkWorkflowRunProperties(workflowRuns.get(1), workflow.getId()); } - private static void checkWorkflowRunProperties(GHWorkflowRun workflowRun, long workflowId) throws IOException { + private static void checkWorkflowRunProperties(GHWorkflowRun workflowRun, long workflowId) { assertThat(workflowRun.getWorkflowId(), equalTo(workflowId)); assertThat(workflowRun.getId(), notNullValue()); assertThat(workflowRun.getNodeId(), notNullValue()); diff --git a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java index bb863eae72..384087d0ed 100644 --- a/src/test/java/org/kohsuke/github/GitHubConnectionTest.java +++ b/src/test/java/org/kohsuke/github/GitHubConnectionTest.java @@ -33,12 +33,9 @@ public GitHubConnectionTest() { /** * Test offline. - * - * @throws Exception - * the exception */ @Test - public void testOffline() throws Exception { + public void testOffline() { GitHub hub = GitHub.offline(); assertThat(GitHubRequest.getApiURL(hub.getClient().getApiUrl(), "/test").toString(), equalTo("https://api.github.invalid/test")); @@ -259,12 +256,9 @@ private String getTestDirectory() { /** * Test anonymous. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ @Test - public void testAnonymous() throws IOException { + public void testAnonymous() { // we disable this test for JDK 16+ as the current hacks in setupEnvironment() don't work with JDK 16+ Assume.assumeThat(Double.valueOf(System.getProperty("java.specification.version")), lessThan(16.0)); diff --git a/src/test/java/org/kohsuke/github/GitHubStaticTest.java b/src/test/java/org/kohsuke/github/GitHubStaticTest.java index 729b130a8c..a00f4c95b9 100644 --- a/src/test/java/org/kohsuke/github/GitHubStaticTest.java +++ b/src/test/java/org/kohsuke/github/GitHubStaticTest.java @@ -56,23 +56,17 @@ public void testParseURL() throws Exception { /** * Test parse instant. - * - * @throws Exception - * the exception */ @Test - public void testParseInstant() throws Exception { + public void testParseInstant() { assertThat(GitHubClient.parseInstant(null), nullValue()); } /** * Test raw url path invalid. - * - * @throws Exception - * the exception */ @Test - public void testRawUrlPathInvalid() throws Exception { + public void testRawUrlPathInvalid() { try { gitHub.createRequest().setRawUrlPath("invalid.path.com"); fail(); @@ -83,12 +77,9 @@ public void testRawUrlPathInvalid() throws Exception { /** * Time round trip. - * - * @throws Exception - * the exception */ @Test - public void timeRoundTrip() throws Exception { + public void timeRoundTrip() { final long stableInstantEpochMilli = 1533721222255L; Instant instantNow = Instant.ofEpochMilli(stableInstantEpochMilli); @@ -148,12 +139,9 @@ public void timeRoundTrip() throws Exception { /** * Test from record. - * - * @throws Exception - * the exception */ @Test - public void testFromRecord() throws Exception { + public void testFromRecord() { final long stableInstantEpochSeconds = 11610674762L; GHRateLimit rateLimit_none = GHRateLimit.fromRecord(new GHRateLimit.Record(9876, @@ -396,12 +384,9 @@ public void testMappingReaderWriter() throws Exception { /** * Test git hub request get api URL. - * - * @throws Exception - * the exception */ @Test - public void testGitHubRequest_getApiURL() throws Exception { + public void testGitHubRequest_getApiURL() { assertThat(GitHubRequest.getApiURL("github.com", "/endpoint").toString(), equalTo("https://api.github.com/endpoint")); diff --git a/src/test/java/org/kohsuke/github/GitHubTest.java b/src/test/java/org/kohsuke/github/GitHubTest.java index f8f352179d..2c26f48daf 100644 --- a/src/test/java/org/kohsuke/github/GitHubTest.java +++ b/src/test/java/org/kohsuke/github/GitHubTest.java @@ -114,12 +114,9 @@ public void listOrganizationsFetchesType() throws IOException { /** * Search users. - * - * @throws Exception - * the exception */ @Test - public void searchUsers() throws Exception { + public void searchUsers() { PagedSearchIterable r = gitHub.searchUsers().q("tom").repos(">42").followers(">1000").list(); GHUser u = r.iterator().next(); // System.out.println(u.getName()); @@ -129,12 +126,9 @@ public void searchUsers() throws Exception { /** * Test list all repositories. - * - * @throws Exception - * the exception */ @Test - public void testListAllRepositories() throws Exception { + public void testListAllRepositories() { Iterator itr = gitHub.listAllPublicRepositories().iterator(); for (int i = 0; i < 115; i++) { assertThat(itr.hasNext(), is(true)); @@ -276,12 +270,9 @@ public void searchContentWithForks() { /** * Test list my authorizations. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ @Test - public void testListMyAuthorizations() throws IOException { + public void testListMyAuthorizations() { PagedIterable list = gitHub.listMyAuthorizations(); for (GHAuthorization auth : list) { diff --git a/src/test/java/org/kohsuke/github/RequesterRetryTest.java b/src/test/java/org/kohsuke/github/RequesterRetryTest.java index 5675036a29..81a8b34ec9 100644 --- a/src/test/java/org/kohsuke/github/RequesterRetryTest.java +++ b/src/test/java/org/kohsuke/github/RequesterRetryTest.java @@ -84,21 +84,16 @@ public void attachLogCapturer() { * Gets the test captured log. * * @return the test captured log - * @throws IOException - * Signals that an I/O exception has occurred. */ - public String getTestCapturedLog() throws IOException { + public String getTestCapturedLog() { customLogHandler.flush(); return logCapturingStream.toString(); } /** * Reset test captured log. - * - * @throws IOException - * Signals that an I/O exception has occurred. */ - public void resetTestCapturedLog() throws IOException { + public void resetTestCapturedLog() { Logger.getLogger(GitHubClient.class.getName()).removeHandler(customLogHandler); Logger.getLogger(OkHttpClient.class.getName()).removeHandler(customLogHandler); customLogHandler.close(); diff --git a/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java b/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java index eb1a5e143a..bf9f63371e 100644 --- a/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java +++ b/src/test/java/org/kohsuke/github/WireMockStatusReporterTest.java @@ -158,12 +158,9 @@ public void BasicBehaviors_whenProxying() throws Exception { /** * When snapshot ensure proxy. - * - * @throws Exception - * the exception */ @Test - public void whenSnapshot_EnsureProxy() throws Exception { + public void whenSnapshot_EnsureProxy() { assumeTrue("Test only valid when Snapshotting (-Dtest.github.takeSnapshot to enable)", mockGitHub.isTakeSnapshot()); @@ -172,13 +169,10 @@ public void whenSnapshot_EnsureProxy() throws Exception { /** * When snapshot ensure record to expected location. - * - * @throws Exception - * the exception */ @Ignore("Not implemented yet") @Test - public void whenSnapshot_EnsureRecordToExpectedLocation() throws Exception { + public void whenSnapshot_EnsureRecordToExpectedLocation() { assumeTrue("Test only valid when Snapshotting (-Dtest.github.takeSnapshot to enable)", mockGitHub.isTakeSnapshot()); diff --git a/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpGitHubConnectorTest.java b/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpGitHubConnectorTest.java index d21e853bc3..fcca58b931 100644 --- a/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpGitHubConnectorTest.java +++ b/src/test/java/org/kohsuke/github/extras/okhttp3/OkHttpGitHubConnectorTest.java @@ -260,7 +260,7 @@ public void OkHttpConnector_Cache_MaxAgeDefault_Zero() throws Exception { assertThat("getHitCount", cache.hitCount(), is(maxAgeZeroHitCount)); } - private void checkRequestAndLimit(int networkRequestCount, int rateLimitUsed) throws IOException { + private void checkRequestAndLimit(int networkRequestCount, int rateLimitUsed) { GHRateLimit rateLimitAfter = gitHub.lastRateLimit(); assertThat("Request Count", getRequestCount(), is(networkRequestCount + userRequestCount));