Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 98dafb3

Browse filesBrowse files
author
Sahan Serasinghe
authored
Merge branch 'main' into refactor-search-forks
2 parents 89acb05 + abf5a6d commit 98dafb3
Copy full SHA for 98dafb3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree

43 files changed

+982
-416
lines changed

‎pom.xml

Copy file name to clipboardExpand all lines: pom.xml
+147-41Lines changed: 147 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333

3434
<properties>
3535
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
36-
<spotbugs-maven-plugin.version>4.4.2.2</spotbugs-maven-plugin.version>
37-
<spotbugs.version>4.4.2</spotbugs.version>
36+
<spotbugs-maven-plugin.version>4.5.0.0</spotbugs-maven-plugin.version>
37+
<spotbugs.version>4.5.0</spotbugs.version>
3838
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
3939
<hamcrest.version>2.2</hamcrest.version>
4040
<okhttp3.version>4.9.2</okhttp3.version>
@@ -103,32 +103,36 @@
103103
<groupId>org.jacoco</groupId>
104104
<artifactId>jacoco-maven-plugin</artifactId>
105105
<version>0.8.7</version>
106+
<configuration>
107+
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
108+
<excludes>
109+
<exclude>/org/kohsuke/github/extras/HttpClient*</exclude>
110+
</excludes>
111+
</configuration>
106112
<executions>
107113
<execution>
108114
<goals>
109-
<goal>prepare-agent</goal>
115+
<goal>prepare-agent-integration</goal>
110116
</goals>
111117
<configuration>
112118
<propertyName>jacoco.surefire.argLine</propertyName>
113-
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
114-
<include>org.kohsuke.*</include>
115119
</configuration>
116120
</execution>
117121
<!-- attached to Maven test phase -->
118122
<execution>
119123
<id>report</id>
120-
<phase>test</phase>
121124
<goals>
122-
<goal>report</goal>
125+
<goal>report-integration</goal>
123126
</goals>
124127
</execution>
125128
<execution>
126129
<id>check</id>
127-
<phase>test</phase>
130+
<phase>verify</phase>
128131
<goals>
129132
<goal>check</goal>
130133
</goals>
131134
<configuration>
135+
<dataFile>${project.build.directory}/jacoco-it.exec</dataFile>
132136
<rules>
133137
<rule>
134138
<element>BUNDLE</element>
@@ -153,14 +157,17 @@
153157
</limit>
154158
</limits>
155159
<excludes>
160+
<!-- Java 11 multi-release overlay problems -->
161+
<exclude>org.kohsuke.github.extras.HttpClientGitHubConnector.**</exclude>
162+
<exclude>org.kohsuke.github.extras.HttpClientGitHubConnector</exclude>
163+
156164
<!-- Code implemented externally -->
157165
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory.**</exclude>
158166
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory</exclude>
159167

160168
<!-- Sample only -->
161169
<exclude>org.kohsuke.github.example.*</exclude>
162170

163-
164171
<!-- Deprecated -->
165172
<exclude>org.kohsuke.github.extras.OkHttpConnector</exclude>
166173
<exclude>org.kohsuke.github.extras.OkHttp3Connector</exclude>
@@ -220,6 +227,27 @@
220227
<autoReleaseAfterClose>true</autoReleaseAfterClose>
221228
</configuration>
222229
</plugin>
230+
<plugin>
231+
<groupId>org.codehaus.mojo</groupId>
232+
<artifactId>animal-sniffer-maven-plugin</artifactId>
233+
<version>1.20</version>
234+
<configuration>
235+
<signature>
236+
<groupId>org.codehaus.mojo.signature</groupId>
237+
<artifactId>java18</artifactId>
238+
<version>1.0</version>
239+
</signature>
240+
</configuration>
241+
<executions>
242+
<execution>
243+
<id>ensure-java-1.8-class-library</id>
244+
<phase>test</phase>
245+
<goals>
246+
<goal>check</goal>
247+
</goals>
248+
</execution>
249+
</executions>
250+
</plugin>
223251
</plugins>
224252
</pluginManagement>
225253
<plugins>
@@ -285,23 +313,6 @@
285313
<plugin>
286314
<groupId>org.codehaus.mojo</groupId>
287315
<artifactId>animal-sniffer-maven-plugin</artifactId>
288-
<version>1.20</version>
289-
<configuration>
290-
<signature>
291-
<groupId>org.codehaus.mojo.signature</groupId>
292-
<artifactId>java18</artifactId>
293-
<version>1.0</version>
294-
</signature>
295-
</configuration>
296-
<executions>
297-
<execution>
298-
<id>ensure-java-1.8-class-library</id>
299-
<phase>test</phase>
300-
<goals>
301-
<goal>check</goal>
302-
</goals>
303-
</execution>
304-
</executions>
305316
</plugin>
306317
<plugin>
307318
<groupId>com.infradna.tool</groupId>
@@ -331,6 +342,12 @@
331342
</executions>
332343
<configuration>
333344
<java>
345+
<includes>
346+
<include>src/main/java/**/*.java</include>
347+
<include>src/main/java11/**/*.java</include>
348+
<include>src/test/java/**/*.java</include>
349+
</includes>
350+
334351
<eclipse>
335352
<file>${basedir}/src/build/eclipse/formatter.xml</file>
336353
</eclipse>
@@ -520,7 +537,7 @@
520537
<dependency>
521538
<groupId>org.mockito</groupId>
522539
<artifactId>mockito-core</artifactId>
523-
<version>4.0.0</version>
540+
<version>4.1.0</version>
524541
<scope>test</scope>
525542
</dependency>
526543
<dependency>
@@ -576,33 +593,24 @@
576593
<executions>
577594
<execution>
578595
<id>okhttp-test</id>
579-
<phase>test</phase>
596+
<phase>integration-test</phase>
580597
<goals>
581598
<goal>test</goal>
582599
</goals>
583600
<configuration>
601+
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
584602
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
585603
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=okhttp</argLine>
586604
</configuration>
587605
</execution>
588-
<execution>
589-
<id>okhttpconnector-test</id>
590-
<phase>test</phase>
591-
<goals>
592-
<goal>test</goal>
593-
</goals>
594-
<configuration>
595-
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
596-
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=okhttpconnector</argLine>
597-
</configuration>
598-
</execution>
599606
<execution>
600607
<id>slow-or-flaky-test</id>
601-
<phase>test</phase>
608+
<phase>integration-test</phase>
602609
<goals>
603610
<goal>test</goal>
604611
</goals>
605612
<configuration>
613+
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
606614
<rerunFailingTestsCount>2</rerunFailingTestsCount>
607615
<!-- There are some tests that take longer or are a little
608616
flaky. Run them here. -->
@@ -672,7 +680,7 @@
672680
<rules>
673681
<requireFilesExist>
674682
<files>
675-
<file>${project.build.directory}/jacoco.exec</file>
683+
<file>${project.build.directory}/jacoco-it.exec</file>
676684
</files>
677685
</requireFilesExist>
678686
</rules>
@@ -738,6 +746,104 @@
738746
</plugins>
739747
</build>
740748
</profile>
749+
<profile>
750+
<id>multirelease</id>
751+
<activation>
752+
<jdk>[11,)</jdk>
753+
</activation>
754+
<build>
755+
<plugins>
756+
<plugin>
757+
<groupId>org.codehaus.mojo</groupId>
758+
<artifactId>animal-sniffer-maven-plugin</artifactId>
759+
<configuration>
760+
<ignores>
761+
java.net.http.*
762+
</ignores>
763+
</configuration>
764+
</plugin>
765+
<plugin>
766+
<artifactId>maven-compiler-plugin</artifactId>
767+
<version>3.8.1</version>
768+
<executions>
769+
<execution>
770+
<id>compile-java-11</id>
771+
<phase>compile</phase>
772+
<goals>
773+
<goal>compile</goal>
774+
</goals>
775+
<configuration>
776+
<release>11</release>
777+
<source>11</source>
778+
<target>11</target>
779+
<compileSourceRoots>
780+
<compileSourceRoot>${project.basedir}/src/main/java11</compileSourceRoot>
781+
</compileSourceRoots>
782+
<multiReleaseOutput>true</multiReleaseOutput>
783+
</configuration>
784+
</execution>
785+
</executions>
786+
</plugin>
787+
<plugin>
788+
<groupId>org.apache.maven.plugins</groupId>
789+
<artifactId>maven-jar-plugin</artifactId>
790+
<version>3.2.0</version>
791+
<configuration>
792+
<archive>
793+
<manifestEntries>
794+
<Multi-Release>true</Multi-Release>
795+
</manifestEntries>
796+
</archive>
797+
</configuration>
798+
</plugin>
799+
</plugins>
800+
</build>
801+
</profile>
802+
<profile>
803+
<id>multirelease-test</id>
804+
<activation>
805+
<jdk>[11,)</jdk>
806+
<property>
807+
<name>!test</name>
808+
</property>
809+
</activation>
810+
<build>
811+
<plugins>
812+
<plugin>
813+
<artifactId>maven-surefire-plugin</artifactId>
814+
<executions>
815+
<execution>
816+
<id>java11-test</id>
817+
<phase>integration-test</phase>
818+
<goals>
819+
<goal>test</goal>
820+
</goals>
821+
<configuration>
822+
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
823+
<useSystemClassLoader>false</useSystemClassLoader>
824+
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
825+
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=httpclient</argLine>
826+
</configuration>
827+
</execution>
828+
<execution>
829+
<id>java11-urlconnection-test</id>
830+
<phase>integration-test</phase>
831+
<goals>
832+
<goal>test</goal>
833+
</goals>
834+
<configuration>
835+
<classesDirectory>${project.basedir}/target/github-api-${project.version}.jar</classesDirectory>
836+
<useSystemClassLoader>false</useSystemClassLoader>
837+
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
838+
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine} -Dtest.github.connector=urlconnection</argLine>
839+
</configuration>
840+
</execution>
841+
</executions>
842+
</plugin>
843+
</plugins>
844+
</build>
845+
</profile>
846+
741847
</profiles>
742848
<reporting>
743849
<plugins>

‎src/main/java/org/kohsuke/github/AbstractBuilder.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/AbstractBuilder.java
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@
3737
* @param <S>
3838
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
3939
* the same as {@link R}, this builder will commit changes after each call to {@link #with(String, Object)}.
40+
*
41+
* @author Liam Newman
4042
*/
4143
abstract class AbstractBuilder<R, S> extends GitHubInteractiveObject {
4244

‎src/main/java/org/kohsuke/github/AbuseLimitHandler.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/AbuseLimitHandler.java
+10-6Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@
1212
* Pluggable strategy to determine what to do when the API abuse limit is hit.
1313
*
1414
* @author Kohsuke Kawaguchi
15-
* @see GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler) GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
15+
* @see GitHubBuilder#withAbuseLimitHandler(GitHubAbuseLimitHandler)
16+
* GitHubBuilder#withAbuseLimitHandler(GitHubAbuseLimitHandler)
1617
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
1718
* @see RateLimitHandler
19+
* @deprecated Switch to {@link GitHubAbuseLimitHandler}.
1820
*/
19-
public abstract class AbuseLimitHandler {
21+
@Deprecated
22+
public abstract class AbuseLimitHandler extends GitHubAbuseLimitHandler {
2023

2124
/**
2225
* Called when the library encounters HTTP error indicating that the API abuse limit is reached.
@@ -37,7 +40,7 @@ public abstract class AbuseLimitHandler {
3740
*
3841
*/
3942
public void onError(@Nonnull GitHubConnectorResponse connectorResponse) throws IOException {
40-
GHIOException e = new HttpException("Abuse limit violation",
43+
GHIOException e = new HttpException("Abuse limit reached",
4144
connectorResponse.statusCode(),
4245
connectorResponse.header("Status"),
4346
connectorResponse.request().url().toString()).withResponseHeaderFields(connectorResponse.allHeaders());
@@ -66,12 +69,12 @@ public void onError(@Nonnull GitHubConnectorResponse connectorResponse) throws I
6669
*
6770
*/
6871
@Deprecated
69-
public void onError(IOException e, HttpURLConnection uc) throws IOException {
70-
}
72+
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
7173

7274
/**
7375
* Wait until the API abuse "wait time" is passed.
7476
*/
77+
@Deprecated
7578
public static final AbuseLimitHandler WAIT = new AbuseLimitHandler() {
7679
@Override
7780
public void onError(IOException e, HttpURLConnection uc) throws IOException {
@@ -94,10 +97,11 @@ private long parseWaitTime(HttpURLConnection uc) {
9497
/**
9598
* Fail immediately.
9699
*/
100+
@Deprecated
97101
public static final AbuseLimitHandler FAIL = new AbuseLimitHandler() {
98102
@Override
99103
public void onError(IOException e, HttpURLConnection uc) throws IOException {
100-
throw (IOException) new IOException("Abuse limit reached").initCause(e);
104+
throw e;
101105
}
102106
};
103107
}

‎src/main/java/org/kohsuke/github/GHEvent.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHEvent.java
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
1111
*/
1212
public enum GHEvent {
13+
BRANCH_PROTECTION_RULE,
1314
CHECK_RUN,
1415
CHECK_SUITE,
1516
CODE_SCANNING_ALERT,

‎src/main/java/org/kohsuke/github/GHRateLimit.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHRateLimit.java
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
/**
2525
* Rate limit.
2626
*
27-
* @author Kohsuke Kawaguchi
27+
* @author Liam Newman
2828
*/
2929
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
3030
public class GHRateLimit {
@@ -380,6 +380,7 @@ static void reset() {
380380
* A rate limit record.
381381
*
382382
* @since 1.100
383+
* @author Liam Newman
383384
*/
384385
public static class Record {
385386
/**

‎src/main/java/org/kohsuke/github/GitHub.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GitHub.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public class GitHub {
113113
*/
114114
GitHub(String apiUrl,
115115
GitHubConnector connector,
116-
RateLimitHandler rateLimitHandler,
117-
AbuseLimitHandler abuseLimitHandler,
116+
GitHubRateLimitHandler rateLimitHandler,
117+
GitHubAbuseLimitHandler abuseLimitHandler,
118118
GitHubRateLimitChecker rateLimitChecker,
119119
AuthorizationProvider authorizationProvider) throws IOException {
120120
if (authorizationProvider instanceof DependentAuthorizationProvider) {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.