Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bitwiseman committed Nov 1, 2019
2 parents cc5ea77 + 0e60871 commit ba658f7
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
80 changes: 79 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,18 @@
</properties>

<build>
<extensions>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.11.2</version>
</extension>
<extension>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.11.2</version>
</extension>
</extensions>
<testResources>
<testResource>
<directory>src/test/resources</directory>
Expand All @@ -60,9 +72,45 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<source>8</source>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.8.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
<useReleaseProfile>false</useReleaseProfile>
<releaseProfiles>release</releaseProfiles>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
<artifactId>bcel</artifactId>
<version>6.4.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
Expand Down Expand Up @@ -292,7 +340,7 @@
<id>jacoco</id>
<activation>
<property>
<name>!jacoco.disabled</name>
<name>enable-jacoco</name>
</property>
</activation>
<build>
Expand Down Expand Up @@ -385,13 +433,43 @@
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
</plugin>
</plugins>
</reporting>

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/kohsuke/github/AbuseLimitHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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);
}
}
Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/kohsuke/github/GHApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public void setPermissions(Map<String, String> permissions) {
* You must use a JWT to access this endpoint.
*
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
* @return a list of App installations
*/
@Preview @Deprecated
public PagedIterable<GHAppInstallation> listInstallations() {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GHProject.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

/**
* A GitHub project.
* @see https://developer.github.com/v3/projects/
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
* @author Martin van Zijl
*/
public class GHProject extends GHObject {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/kohsuke/github/GHRepository.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tt>git log id1...id2</tt> against a local repository.
* to calling <code>git log id1...id2</code> 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
Expand Down Expand Up @@ -928,7 +928,7 @@ public PagedIterable<GHRef> 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. <tt>tags</tt> or <tt>commits</tt>
* @param refType the type of reg to search for e.g. <code>tags</code> or <code>commits</code>
* @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
*/
Expand All @@ -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. <tt>tags</tt> or <tt>commits</tt>
* @param refType the type of reg to search for e.g. <code>tags</code> or <code>commits</code>
* @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
*/
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/kohsuke/github/GitHub.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tt>/api/v3</tt> in the URL.
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <code>/api/v3</code> 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
Expand Down Expand Up @@ -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 <tt>/api/v3</tt> in the URL.
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <code>/api/v3</code> 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 {
Expand Down Expand Up @@ -551,7 +551,7 @@ public Map<String, GHOrganization> 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
*/
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/kohsuke/github/GitHubBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tt>/api/v3</tt> in the URL.
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <code>/api/v3</code> in the URL.
* For historical reasons, this parameter still accepts the bare domain name, but that's considered deprecated.
*/
public GitHubBuilder withEndpoint(String endpoint) {
Expand Down
7 changes: 7 additions & 0 deletions src/test/java/org/kohsuke/github/GitHubStaticTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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'");
Expand All @@ -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)))));

Expand All @@ -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)));

Expand Down

0 comments on commit ba658f7

Please sign in to comment.