From 8faecba0a2730320ab82dacfbc7211c18aa51e02 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 31 Oct 2019 13:25:31 -0700 Subject: [PATCH 1/5] Fix site errors --- .github/workflows/maven-build.yml | 2 +- pom.xml | 44 ++++++++++++++++++- .../org/kohsuke/github/AbuseLimitHandler.java | 3 +- src/main/java/org/kohsuke/github/GHApp.java | 1 + .../java/org/kohsuke/github/GHProject.java | 2 +- src/main/java/org/kohsuke/github/GitHub.java | 2 +- 6 files changed, 48 insertions(+), 6 deletions(-) diff --git a/.github/workflows/maven-build.yml b/.github/workflows/maven-build.yml index 8a086a74e7..f009de37cb 100644 --- a/.github/workflows/maven-build.yml +++ b/.github/workflows/maven-build.yml @@ -19,4 +19,4 @@ jobs: - name: Maven Download all dependencies run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline - name: Maven Build - run: mvn -B package --file pom.xml + run: mvn -B install site --file pom.xml diff --git a/pom.xml b/pom.xml index 4f1be9cf7e..a0acf7cc23 100644 --- a/pom.xml +++ b/pom.xml @@ -60,9 +60,45 @@ jacoco-maven-plugin 0.8.5 + + org.apache.maven.plugins + maven-javadoc-plugin + 3.1.1 + + + + org.apache.maven.plugins + maven-site-plugin + 3.8.2 + + + maven-release-plugin + 2.5.3 + + release + + + + org.apache.maven.plugins + maven-project-info-reports-plugin + 3.0.0 + + + org.apache.bcel + bcel + 6.4.1 + + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + maven-compiler-plugin 3.8.1 @@ -217,7 +253,7 @@ org.eclipse.jgit org.eclipse.jgit - 5.5.1.201910021850-r + 5.4.3.201909031940-r test @@ -292,7 +328,7 @@ jacoco - !jacoco.disabled + enable-jacoco @@ -392,6 +428,10 @@ org.apache.maven.plugins maven-javadoc-plugin + + org.apache.maven.plugins + maven-project-info-reports-plugin + diff --git a/src/main/java/org/kohsuke/github/AbuseLimitHandler.java b/src/main/java/org/kohsuke/github/AbuseLimitHandler.java index 7d4d0e4b66..2c21cdaf9c 100644 --- a/src/main/java/org/kohsuke/github/AbuseLimitHandler.java +++ b/src/main/java/org/kohsuke/github/AbuseLimitHandler.java @@ -27,6 +27,7 @@ public abstract class AbuseLimitHandler { * this exception (or wrap this exception into another exception and throw it). * @param uc * Connection that resulted in an error. Useful for accessing other response headers. + * @throws IOException */ public abstract void onError(IOException e, HttpURLConnection uc) throws IOException; @@ -38,7 +39,7 @@ public abstract class AbuseLimitHandler { public void onError(IOException e, HttpURLConnection uc) throws IOException { try { Thread.sleep(parseWaitTime(uc)); - } catch (InterruptedException _) { + } catch (InterruptedException ex) { throw (InterruptedIOException)new InterruptedIOException().initCause(e); } } diff --git a/src/main/java/org/kohsuke/github/GHApp.java b/src/main/java/org/kohsuke/github/GHApp.java index 43ad91c5e0..d3a73354b2 100644 --- a/src/main/java/org/kohsuke/github/GHApp.java +++ b/src/main/java/org/kohsuke/github/GHApp.java @@ -104,6 +104,7 @@ public void setPermissions(Map permissions) { * You must use a JWT to access this endpoint. * * @see List installations + * @return a list of App installations */ @Preview @Deprecated public PagedIterable listInstallations() { diff --git a/src/main/java/org/kohsuke/github/GHProject.java b/src/main/java/org/kohsuke/github/GHProject.java index 6645a05a3e..66e347cbc3 100644 --- a/src/main/java/org/kohsuke/github/GHProject.java +++ b/src/main/java/org/kohsuke/github/GHProject.java @@ -32,7 +32,7 @@ /** * A GitHub project. - * @see https://developer.github.com/v3/projects/ + * @see Projects * @author Martin van Zijl */ public class GHProject extends GHObject { diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index 0cbf425970..1c43ef684a 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -551,7 +551,7 @@ public Map getUserPublicOrganizations(GHUser user) throw * * To retrieve full organization details, you need to call {@link #getOrganization(String)} * - * @param user the user to retrieve public Organization membership information for + * @param login the user to retrieve public Organization membership information for * * @return the public Organization memberships for the user */ From 4dcf5dbc1379f821fd54108689bb9871d2b4c8b6 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 31 Oct 2019 14:24:29 -0700 Subject: [PATCH 2/5] More pom fixes --- pom.xml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/pom.xml b/pom.xml index a0acf7cc23..f6affcb966 100644 --- a/pom.xml +++ b/pom.xml @@ -44,6 +44,18 @@ + + + org.apache.maven.scm + maven-scm-provider-gitexe + 1.11.2 + + + org.apache.maven.scm + maven-scm-manager-plexus + 1.11.2 + + src/test/resources @@ -69,16 +81,34 @@ + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + org.apache.maven.plugins maven-site-plugin 3.8.2 + org.apache.maven.plugins maven-release-plugin 2.5.3 + true + false release + deploy From 61f3a3219f5c0c85d7b70fa0795bca10cfd38d85 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 31 Oct 2019 14:29:30 -0700 Subject: [PATCH 3/5] Fix tt incompatible tags --- pom.xml | 49 ++++++++++--------- .../java/org/kohsuke/github/GHRepository.java | 6 +-- src/main/java/org/kohsuke/github/GitHub.java | 4 +- .../org/kohsuke/github/GitHubBuilder.java | 2 +- 4 files changed, 33 insertions(+), 28 deletions(-) diff --git a/pom.xml b/pom.xml index f6affcb966..1edaeacf86 100644 --- a/pom.xml +++ b/pom.xml @@ -80,21 +80,6 @@ - - - org.apache.maven.plugins - maven-gpg-plugin - 1.6 - - - sign-artifacts - verify - - sign - - - - org.apache.maven.plugins maven-site-plugin @@ -123,12 +108,6 @@ - - org.apache.maven.plugins - maven-source-plugin - 3.1.0 - - maven-compiler-plugin 3.8.1 @@ -283,7 +262,7 @@ org.eclipse.jgit org.eclipse.jgit - 5.4.3.201909031940-r + 5.5.1.201910021850-r test @@ -451,6 +430,32 @@ + + release + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.6 + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-source-plugin + 3.1.0 + + + + diff --git a/src/main/java/org/kohsuke/github/GHRepository.java b/src/main/java/org/kohsuke/github/GHRepository.java index b5922bc988..4fd57fde20 100644 --- a/src/main/java/org/kohsuke/github/GHRepository.java +++ b/src/main/java/org/kohsuke/github/GHRepository.java @@ -866,7 +866,7 @@ public GHHook getHook(int id) throws IOException { /** * Gets a comparison between 2 points in the repository. This would be similar - * to calling git log id1...id2 against a local repository. + * to calling git log id1...id2 against a local repository. * @param id1 an identifier for the first point to compare from, this can be a sha1 ID (for a commit, tag etc) or a direct tag name * @param id2 an identifier for the second point to compare to. Can be the same as the first point. * @return the comparison output @@ -928,7 +928,7 @@ public PagedIterable listRefs() throws IOException { /** * Retrieves all refs of the given type for the current GitHub repository. - * @param refType the type of reg to search for e.g. tags or commits + * @param refType the type of reg to search for e.g. tags or commits * @return an array of all refs matching the request type * @throws IOException on failure communicating with GitHub, potentially due to an invalid ref type being requested */ @@ -939,7 +939,7 @@ public GHRef[] getRefs(String refType) throws IOException { /** * Retrieves all refs of the given type for the current GitHub repository. * - * @param refType the type of reg to search for e.g. tags or commits + * @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 */ diff --git a/src/main/java/org/kohsuke/github/GitHub.java b/src/main/java/org/kohsuke/github/GitHub.java index 1c43ef684a..2d90ec0435 100644 --- a/src/main/java/org/kohsuke/github/GitHub.java +++ b/src/main/java/org/kohsuke/github/GitHub.java @@ -115,7 +115,7 @@ public class GitHub { * * @param apiUrl * The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or - * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. + * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. * For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated. * Password is also considered deprecated as it is no longer required for api usage. * @param login @@ -180,7 +180,7 @@ public static GitHub connectToEnterprise(String apiUrl, String oauthAccessToken) * * @param apiUrl * The URL of GitHub (or GitHub Enterprise) API endpoint, such as "https://api.github.com" or - * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. + * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. * For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated. */ public static GitHub connectToEnterpriseWithOAuth(String apiUrl, String login, String oauthAccessToken) throws IOException { diff --git a/src/main/java/org/kohsuke/github/GitHubBuilder.java b/src/main/java/org/kohsuke/github/GitHubBuilder.java index f5e640c1a9..f0db8e609b 100644 --- a/src/main/java/org/kohsuke/github/GitHubBuilder.java +++ b/src/main/java/org/kohsuke/github/GitHubBuilder.java @@ -160,7 +160,7 @@ public static GitHubBuilder fromProperties(Properties props) { /** * @param endpoint * The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or - * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. + * "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has /api/v3 in the URL. * For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated. */ public GitHubBuilder withEndpoint(String endpoint) { From f25dbd15d91ed1bc12a7df74e03503057fef57b4 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 31 Oct 2019 16:10:34 -0700 Subject: [PATCH 4/5] Stabilize time check --- src/test/java/org/kohsuke/github/GitHubStaticTest.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/test/java/org/kohsuke/github/GitHubStaticTest.java b/src/test/java/org/kohsuke/github/GitHubStaticTest.java index 793f23cc7c..9c03a3323b 100644 --- a/src/test/java/org/kohsuke/github/GitHubStaticTest.java +++ b/src/test/java/org/kohsuke/github/GitHubStaticTest.java @@ -26,6 +26,11 @@ public void timeRoundTrip() throws Exception { Date instantSeconds = Date.from(instantNow.truncatedTo(ChronoUnit.SECONDS)); Date instantMillis = Date.from(instantNow.truncatedTo(ChronoUnit.MILLIS)); + // if we happen to land exactly on zero milliseconds, add 1 milli + if (instantSeconds.equals(instantMillis)) { + instantMillis = Date.from(instantNow.plusMillis(1).truncatedTo(ChronoUnit.MILLIS)); + } + // TODO: other formats String instantFormatSlash = formatDate(instantMillis, "yyyy/MM/dd HH:mm:ss ZZZZ"); String instantFormatDash = formatDate(instantMillis, "yyyy-MM-dd'T'HH:mm:ss'Z'"); @@ -40,6 +45,7 @@ public void timeRoundTrip() throws Exception { assertThat(instantSeconds, equalTo(GitHub.parseDate(GitHub.printDate(instantSeconds)))); + // printDate will truncate to the nearest second, so it should not be equal assertThat(instantMillis, not(equalTo(GitHub.parseDate(GitHub.printDate(instantMillis))))); @@ -49,6 +55,7 @@ public void timeRoundTrip() throws Exception { assertThat(instantSeconds, equalTo(GitHub.parseDate(instantFormatDash))); + // This parser does not truncate to the nearest second, so it will be equal assertThat(instantMillis, equalTo(GitHub.parseDate(instantFormatMillis))); From 5f967e6307b959e04ea59917a848b001b0e4725d Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Thu, 31 Oct 2019 17:41:05 -0700 Subject: [PATCH 5/5] Fix javadoc on java 11 --- pom.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pom.xml b/pom.xml index 1edaeacf86..2b24c88e84 100644 --- a/pom.xml +++ b/pom.xml @@ -76,6 +76,9 @@ org.apache.maven.plugins maven-javadoc-plugin 3.1.1 + + 8 +