From 32cf4cad6b1000019b1d171faf98a26b21d5caf1 Mon Sep 17 00:00:00 2001 From: Greg Messner Date: Mon, 30 Jan 2017 20:13:58 -0800 Subject: [PATCH] More Javadoc fixes. --- .../com/messners/gitlab/api/AbstractApi.java | 7 ++- .../com/messners/gitlab/api/CommitsApi.java | 8 +-- .../com/messners/gitlab/api/GitLabApi.java | 5 +- .../messners/gitlab/api/GitLabApiClient.java | 54 +++++++++---------- .../gitlab/api/TestGitLabApiBeans.java | 11 ++-- .../gitlab/api/TestGitLabApiEvents.java | 8 +-- 6 files changed, 46 insertions(+), 47 deletions(-) diff --git a/src/main/java/com/messners/gitlab/api/AbstractApi.java b/src/main/java/com/messners/gitlab/api/AbstractApi.java index 90cdd6b9..eec35f90 100644 --- a/src/main/java/com/messners/gitlab/api/AbstractApi.java +++ b/src/main/java/com/messners/gitlab/api/AbstractApi.java @@ -229,7 +229,7 @@ public abstract class AbstractApi { * @param response response * @param expected expected respone status * @return original response if the response status is expected - * @throws GitLabApiException in case of unexpected response status + * @throws GitLabApiException if HTTP status is not as expected */ protected Response validate(Response response, Response.Status expected) throws GitLabApiException { if (response.getStatus() != expected.getStatusCode()) { @@ -242,9 +242,8 @@ public abstract class AbstractApi { /** * Wraps exception if needed * - * @param thrown exception - * @return never returns - * @throws GitLabApiException always + * @param thrown the exception that should be wrapped + * @throws GitLabApiException containing the cause or GitLab API specific message */ protected GitLabApiException handle(Exception thrown) throws GitLabApiException { diff --git a/src/main/java/com/messners/gitlab/api/CommitsApi.java b/src/main/java/com/messners/gitlab/api/CommitsApi.java index f72d1ff3..357d8edf 100644 --- a/src/main/java/com/messners/gitlab/api/CommitsApi.java +++ b/src/main/java/com/messners/gitlab/api/CommitsApi.java @@ -22,8 +22,8 @@ public class CommitsApi extends AbstractApi { * GET /projects/:id/repository/commits * * @param projectId the project ID to get the list of commits for - * @return a List containing the commits for the specified project ID - * @throws GitLabApiException + * @return a list containing the commits for the specified project ID + * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public List getCommits(int projectId) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", projectId, "repository", "commits"); @@ -39,7 +39,7 @@ public class CommitsApi extends AbstractApi { * @param projectId the project ID that the commit belongs to * @param sha a commit hash or name of a branch or tag * @return the Commit instance for the specified project ID/sha pair - * @throws GitLabApiException + * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Commit getCommits(int projectId, String sha) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", projectId, "repository", "commits", sha); @@ -54,7 +54,7 @@ public class CommitsApi extends AbstractApi { * @param projectId the project ID that the commit belongs to * @param sha a commit hash or name of a branch or tag * @return the Diff instance for the specified project ID/sha pair - * @throws GitLabApiException + * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ public Diff getDiff(int projectId, String sha) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", projectId, "repository", "commits", sha, "diff"); diff --git a/src/main/java/com/messners/gitlab/api/GitLabApi.java b/src/main/java/com/messners/gitlab/api/GitLabApi.java index ad124a48..df24ceb0 100644 --- a/src/main/java/com/messners/gitlab/api/GitLabApi.java +++ b/src/main/java/com/messners/gitlab/api/GitLabApi.java @@ -24,6 +24,7 @@ public class GitLabApi { * @param username user name for which private token should be obtained * @param password password for a given {@code username} * @return new {@code GitLabApi} instance configured for a user-specific token + * @throws GitLabApiException GitLabApiException if any exception occurs during execution */ static public GitLabApi create(String url, String username, String password) throws GitLabApiException { String token = new SessionApi(new GitLabApi(url, null)).login(username, null, password).getPrivateToken(); @@ -34,8 +35,8 @@ public class GitLabApi { * Constructs a GitLabApi instance set up to interact with the GitLab server * specified by hostUrl. * - * @param hostUrl - * @param privateToken + * @param hostUrl the URL of the GitLab server + * @param privateToken to private token to use for access to the API */ public GitLabApi(String hostUrl, String privateToken) { apiClient = new GitLabApiClient(hostUrl, privateToken); diff --git a/src/main/java/com/messners/gitlab/api/GitLabApiClient.java b/src/main/java/com/messners/gitlab/api/GitLabApiClient.java index 050de34f..e8318867 100644 --- a/src/main/java/com/messners/gitlab/api/GitLabApiClient.java +++ b/src/main/java/com/messners/gitlab/api/GitLabApiClient.java @@ -73,11 +73,9 @@ public class GitLabApiClient { /** * Sets up the Jersey system ignore SSL certificate errors or not. * - *

- * WARNING: Setting this to true will affect ALL uses of HttpsURLConnection and Jersey. - *

+ * WARNING: Setting this to true will affect ALL uses of HttpsURLConnection and Jersey. * - * @param ignoreCertificateErrors + * @param ignoreCertificateErrors if true will set up the Jersey system ignore SSL certificate errors */ public void setIgnoreCerificateErrors(boolean ignoreCertificateErrors) { @@ -143,7 +141,7 @@ public class GitLabApiClient { /** * Construct a REST URL with the specified path arguments. * - * @param pathArgs + * @param pathArgs ariable list of arguments used to build the URI * @return a REST URL with the specified path arguments * @throws IOException */ @@ -165,8 +163,8 @@ public class GitLabApiClient { * Perform an HTTP GET call with the specified query parameters and path objects, returning * a ClientResponse instance with the data returned from the endpoint. * - * @param queryParams - * @param pathArgs + * @param queryParams multivalue map of request parameters + * @param pathArgs variable list of arguments used to build the URI * @return a ClientResponse instance with the data returned from the endpoint * @throws IOException */ @@ -179,8 +177,8 @@ public class GitLabApiClient { * Perform an HTTP GET call with the specified query parameters and URL, returning * a ClientResponse instance with the data returned from the endpoint. * - * @param queryParams - * @param url + * @param queryParams multivalue map of request parameters + * @param url the fully formed path to the GitLab API endpoint * @return a ClientResponse instance with the data returned from the endpoint */ protected Response get(MultivaluedMap queryParams, URL url) { @@ -191,8 +189,8 @@ public class GitLabApiClient { * Perform an HTTP POST call with the specified form data and path objects, returning * a ClientResponse instance with the data returned from the endpoint. * - * @param formData - * @param pathArgs + * @param formData the Form containing the name/value pairs + * @param pathArgs variable list of arguments used to build the URI * @return a ClientResponse instance with the data returned from the endpoint * @throws IOException */ @@ -205,9 +203,9 @@ public class GitLabApiClient { * Perform an HTTP POST call with the specified form data and path objects, returning * a ClientResponse instance with the data returned from the endpoint. * - * @param formData - * @param pathArgs - * @return a ClientResponse instance with the data returned from the endpoint + * @param queryParams multivalue map of request parameters + * @param pathArgs variable list of arguments used to build the URI + * @return a Response instance with the data returned from the endpoint * @throws IOException */ protected Response post(MultivaluedMap queryParams, Object... pathArgs) throws IOException { @@ -219,8 +217,8 @@ public class GitLabApiClient { * Perform an HTTP POST call with the specified form data and URL, returning * a ClientResponse instance with the data returned from the endpoint. * - * @param formData - * @param url + * @param formData the Form containing the name/value pairs + * @param url the fully formed path to the GitLab API endpoint * @return a ClientResponse instance with the data returned from the endpoint */ protected Response post(Form formData, URL url) { @@ -230,9 +228,9 @@ public class GitLabApiClient { /** * Perform an HTTP POST call with the specified form data and URL, returning * a ClientResponse instance with the data returned from the endpoint. - * - * @param formData - * @param url + * + * @param queryParams multivalue map of request parametersformData the Form containing the name/value pairs + * @param url the fully formed path to the GitLab API endpoint * @return a ClientResponse instance with the data returned from the endpoint */ protected Response post(MultivaluedMap queryParams, URL url) { @@ -243,8 +241,8 @@ public class GitLabApiClient { * Perform an HTTP PUT call with the specified form data and path objects, returning * a ClientResponse instance with the data returned from the endpoint. * - * @param queryParams - * @param pathArgs + * @param queryParams multivalue map of request parameters + * @param pathArgs variable list of arguments used to build the URI * @return a ClientResponse instance with the data returned from the endpoint * @throws IOException */ @@ -256,9 +254,9 @@ public class GitLabApiClient { /** * Perform an HTTP PUT call with the specified form data and URL, returning * a ClientResponse instance with the data returned from the endpoint. - * - * @param queryParams - * @param url + * + * @param queryParams multivalue map of request parameters + * @param url the fully formed path to the GitLab API endpoint * @return a ClientResponse instance with the data returned from the endpoint */ protected Response put(MultivaluedMap queryParams, URL url) { @@ -269,8 +267,8 @@ public class GitLabApiClient { * Perform an HTTP DELETE call with the specified form data and path objects, returning * a Response instance with the data returned from the endpoint. * - * @param queryParams - * @param pathArgs + * @param queryParams multivalue map of request parameters + * @param pathArgs variable list of arguments used to build the URI * @return a Response instance with the data returned from the endpoint * @throws IOException */ @@ -282,8 +280,8 @@ public class GitLabApiClient { * Perform an HTTP DELETE call with the specified form data and URL, returning * a Response instance with the data returned from the endpoint. * - * @param queryParams - * @param url + * @param queryParams multivalue map of request parameters + * @param url the fully formed path to the GitLab API endpoint * @return a Response instance with the data returned from the endpoint */ protected Response delete(MultivaluedMap queryParams, URL url) { diff --git a/src/test/java/com/messners/gitlab/api/TestGitLabApiBeans.java b/src/test/java/com/messners/gitlab/api/TestGitLabApiBeans.java index 946ddc28..baf07719 100644 --- a/src/test/java/com/messners/gitlab/api/TestGitLabApiBeans.java +++ b/src/test/java/com/messners/gitlab/api/TestGitLabApiBeans.java @@ -6,14 +6,15 @@ import java.io.IOException; import java.io.InputStreamReader; import java.util.List; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.JsonParseException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; -import org.codehaus.jackson.type.TypeReference; import org.junit.BeforeClass; import org.junit.Test; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; + import com.messners.gitlab.api.models.Branch; import com.messners.gitlab.api.models.Diff; import com.messners.gitlab.api.models.Event; diff --git a/src/test/java/com/messners/gitlab/api/TestGitLabApiEvents.java b/src/test/java/com/messners/gitlab/api/TestGitLabApiEvents.java index 17884df0..2a993b5d 100644 --- a/src/test/java/com/messners/gitlab/api/TestGitLabApiEvents.java +++ b/src/test/java/com/messners/gitlab/api/TestGitLabApiEvents.java @@ -5,13 +5,13 @@ import static org.junit.Assert.assertTrue; import java.io.IOException; import java.io.InputStreamReader; -import org.codehaus.jackson.JsonNode; -import org.codehaus.jackson.JsonParseException; -import org.codehaus.jackson.map.JsonMappingException; -import org.codehaus.jackson.map.ObjectMapper; import org.junit.BeforeClass; import org.junit.Test; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import com.messners.gitlab.api.webhook.EventObject; import com.messners.gitlab.api.webhook.PushEvent; -- GitLab