From 1441b9c860bfe884e60eb916e9318c1f103a777b Mon Sep 17 00:00:00 2001 From: Ken McCracken Date: Mon, 26 Jul 2021 21:15:15 -0400 Subject: [PATCH 01/15] retry: add the ability to cap the maxRetryFactor. fix left-shifts so they don't go negative. Signed-off-by: Ken McCracken --- ...cket5xxExponentialRandomBackoffPolicy.java | 14 ++++-- ...5xxExponentialRandomBackoffPolicyTest.java | 44 +++++++++++++++++++ 2 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java diff --git a/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java b/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java index 60fced4e..7e159235 100644 --- a/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java +++ b/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java @@ -11,18 +11,25 @@ public class Socket5xxExponentialRandomBackoffPolicy implements RetryPolicy { public static final int DEFAULT_MAX_NO_RETRIES = 3; public static final int DEFAULT_RETRY_INTERVAL_MILLIS = 1000; + public static final int DEFAULT_MAX_RETRY_FACTOR = 1 << 30; private final int maxNumberOfRetries; private final int retryIntervalMillis; + private final int maxRetryFactor; public Socket5xxExponentialRandomBackoffPolicy(){ - this.maxNumberOfRetries = DEFAULT_MAX_NO_RETRIES; - this.retryIntervalMillis = DEFAULT_RETRY_INTERVAL_MILLIS; + this(DEFAULT_MAX_NO_RETRIES, DEFAULT_RETRY_INTERVAL_MILLIS); } public Socket5xxExponentialRandomBackoffPolicy(int maxNumberOfRetries, int retryIntervalMillis){ + this(maxNumberOfRetries, retryIntervalMillis, DEFAULT_MAX_RETRY_FACTOR); + } + + public Socket5xxExponentialRandomBackoffPolicy(int maxNumberOfRetries, int retryIntervalMillis, + int maxRetryFactor) { this.maxNumberOfRetries = maxNumberOfRetries; this.retryIntervalMillis = retryIntervalMillis; + this.maxRetryFactor = maxRetryFactor; } @Override @@ -36,7 +43,8 @@ public boolean shouldRetry(RetryContext retryContext) { @Override public int getNextRetryIntervalMillis(RetryContext retryContext){ - int factor = 1 << (retryContext.getRetryCount()); + int retryCount = retryContext.getRetryCount(); + int factor = Math.min(1 << (Math.min(retryCount, 30)), maxRetryFactor); return retryIntervalMillis * ThreadLocalRandom.current().nextInt(factor); } } diff --git a/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java b/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java new file mode 100644 index 00000000..58d5ce50 --- /dev/null +++ b/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java @@ -0,0 +1,44 @@ +package com.here.account.oauth2.retry; + +import org.junit.Before; +import org.junit.Test; +import org.mockito.Mockito; +import java.net.SocketTimeoutException; +import com.here.account.http.HttpProvider; + +import static org.junit.Assert.assertTrue; + +public class Socket5xxExponentialRandomBackoffPolicyTest { + + private Socket5xxExponentialRandomBackoffPolicy socket5xxExponentialRandomBackoffPolicy; + int maxNumberOfRetries = Integer.MAX_VALUE; + int retryIntervalMillis = 500; + int maxRetryFactor = 5; + + @Before + public void setUp() { + this.socket5xxExponentialRandomBackoffPolicy = + new Socket5xxExponentialRandomBackoffPolicy( maxNumberOfRetries, retryIntervalMillis, + maxRetryFactor); + } + + @Test + public void test_shouldRetry() { + HttpProvider.HttpResponse httpResponse = Mockito.mock(HttpProvider.HttpResponse.class); + Mockito.when(httpResponse.getStatusCode()).thenReturn(503); + Exception lastException = Mockito.mock(SocketTimeoutException.class); + RetryContext retryContext = new RetryContext(); + retryContext.setLastRetryResponse(httpResponse); + retryContext.setLastException(lastException); + final int maxRetryIntervalMillis = maxRetryFactor * retryIntervalMillis; + for (int i = 0; i < 1000; i++) { + retryContext.incrementRetryCount(); + assertTrue("shouldRetry should have been true", + socket5xxExponentialRandomBackoffPolicy.shouldRetry(retryContext)); + int nextRetryIntervalMillis = socket5xxExponentialRandomBackoffPolicy.getNextRetryIntervalMillis(retryContext); + assertTrue("unexpected nextRetryIntervalMillis " + + nextRetryIntervalMillis + ", should be >= 0 and <= " + maxRetryIntervalMillis, + nextRetryIntervalMillis >= 0 && nextRetryIntervalMillis <= maxRetryIntervalMillis); + } + } +} From 77d336b1b2e2860b759084cb1da58ed3cfb69623 Mon Sep 17 00:00:00 2001 From: Ken McCracken Date: Tue, 27 Jul 2021 11:22:28 -0400 Subject: [PATCH 02/15] retry: add comments to getNextRetryIntervalMillis. Signed-off-by: Ken McCracken --- .../here-oauth-client-example/dependency-reduced-pom.xml | 4 ++-- .../retry/Socket5xxExponentialRandomBackoffPolicy.java | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/here-oauth-client-example/dependency-reduced-pom.xml b/examples/here-oauth-client-example/dependency-reduced-pom.xml index 61f0718e..d0a63362 100644 --- a/examples/here-oauth-client-example/dependency-reduced-pom.xml +++ b/examples/here-oauth-client-example/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ here-aaa-sdk com.here.account - 0.4.22 + 0.4.23-SNAPSHOT ../../pom.xml 4.0.0 @@ -71,7 +71,7 @@ junit junit - 4.11 + 4.13.1 test diff --git a/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java b/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java index 7e159235..84be535d 100644 --- a/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java +++ b/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java @@ -41,6 +41,13 @@ public boolean shouldRetry(RetryContext retryContext) { || (null != retryContext.getLastException() && retryContext.getLastException().getCause() instanceof SocketTimeoutException); } + /** + * Employs the exponential random backoff policy using a base of 2 and exponent of number of retries, + * up to a maximum, subject to the configured maxRetryFactor, and multiplied by the retryIntervalMillis. + * + * @param retryContext An instance of {@link RetryContext} + * @return the next retry interval in milliseconds + */ @Override public int getNextRetryIntervalMillis(RetryContext retryContext){ int retryCount = retryContext.getRetryCount(); From 6ee453a442f8383ae32332e9af9f8f1fd2a9487f Mon Sep 17 00:00:00 2001 From: Ken McCracken Date: Mon, 23 Aug 2021 13:30:29 -0400 Subject: [PATCH 03/15] whitespace Signed-off-by: Ken McCracken --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index cd2c5fe2..ce5e187e 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Server, for use with HERE Services. 0.4.23 ``` + HERE OAuth Client Examples ------ Example usage of the HERE OAuth Client library; these are tutorials intended to be adapted into or From 056410d55a7e7ac6c4fff55661da4e625e47f69f Mon Sep 17 00:00:00 2001 From: here-aaa-sdk Date: Thu, 4 Nov 2021 11:02:28 -0400 Subject: [PATCH 04/15] Upgrade gpg Signed-off-by: Ken McCracken --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index cf64a235..11d74027 100644 --- a/pom.xml +++ b/pom.xml @@ -55,9 +55,9 @@ 2.19.1 3.0.2 2.10.4 - 3.0.1 + 2.3 2.8.2 - 1.6 + 3.0.1 3.0.1 From ff34adcacb9106f62d0d188ca9718742e551db12 Mon Sep 17 00:00:00 2001 From: here-aaa-sdk Date: Thu, 4 Nov 2021 11:13:14 -0400 Subject: [PATCH 05/15] Make release 0.4.23 Signed-off-by: Ken McCracken --- examples/here-oauth-client-example/dependency-reduced-pom.xml | 2 +- examples/here-oauth-client-example/pom.xml | 2 +- here-oauth-client-dist/pom.xml | 2 +- here-oauth-client/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/here-oauth-client-example/dependency-reduced-pom.xml b/examples/here-oauth-client-example/dependency-reduced-pom.xml index d0a63362..8d29340b 100644 --- a/examples/here-oauth-client-example/dependency-reduced-pom.xml +++ b/examples/here-oauth-client-example/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ here-aaa-sdk com.here.account - 0.4.23-SNAPSHOT + 0.4.23 ../../pom.xml 4.0.0 diff --git a/examples/here-oauth-client-example/pom.xml b/examples/here-oauth-client-example/pom.xml index 3328e1e4..8e2a000e 100644 --- a/examples/here-oauth-client-example/pom.xml +++ b/examples/here-oauth-client-example/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.23-SNAPSHOT + 0.4.23 ../../pom.xml diff --git a/here-oauth-client-dist/pom.xml b/here-oauth-client-dist/pom.xml index f7140478..fc2cec0f 100644 --- a/here-oauth-client-dist/pom.xml +++ b/here-oauth-client-dist/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.23-SNAPSHOT + 0.4.23 ../pom.xml diff --git a/here-oauth-client/pom.xml b/here-oauth-client/pom.xml index d4505f96..8d86c178 100644 --- a/here-oauth-client/pom.xml +++ b/here-oauth-client/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.23-SNAPSHOT + 0.4.23 ../pom.xml diff --git a/pom.xml b/pom.xml index 11d74027..202a26ad 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ HERE AAA Client SDK Parent POM com.here.account here-aaa-sdk - 0.4.23-SNAPSHOT + 0.4.23 pom here-aaa-sdk is for clients of the HERE AAA, and demos grant_type=client_credentials http://github.com/heremaps/here-aaa-java-sdk From e2bb5861efadc9d65669146e91671adec04e5073 Mon Sep 17 00:00:00 2001 From: here-aaa-sdk Date: Thu, 4 Nov 2021 11:26:32 -0400 Subject: [PATCH 06/15] Update to next release version 0.4.24-SNAPSHOT Signed-off-by: Ken McCracken --- examples/here-oauth-client-example/dependency-reduced-pom.xml | 2 +- examples/here-oauth-client-example/pom.xml | 2 +- here-oauth-client-dist/pom.xml | 2 +- here-oauth-client/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/here-oauth-client-example/dependency-reduced-pom.xml b/examples/here-oauth-client-example/dependency-reduced-pom.xml index 8d29340b..03942d59 100644 --- a/examples/here-oauth-client-example/dependency-reduced-pom.xml +++ b/examples/here-oauth-client-example/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ here-aaa-sdk com.here.account - 0.4.23 + 0.4.24-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/examples/here-oauth-client-example/pom.xml b/examples/here-oauth-client-example/pom.xml index 8e2a000e..1aeec749 100644 --- a/examples/here-oauth-client-example/pom.xml +++ b/examples/here-oauth-client-example/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.23 + 0.4.24-SNAPSHOT ../../pom.xml diff --git a/here-oauth-client-dist/pom.xml b/here-oauth-client-dist/pom.xml index fc2cec0f..e541d9c6 100644 --- a/here-oauth-client-dist/pom.xml +++ b/here-oauth-client-dist/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.23 + 0.4.24-SNAPSHOT ../pom.xml diff --git a/here-oauth-client/pom.xml b/here-oauth-client/pom.xml index 8d86c178..15cae67a 100644 --- a/here-oauth-client/pom.xml +++ b/here-oauth-client/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.23 + 0.4.24-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 202a26ad..814cc347 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ HERE AAA Client SDK Parent POM com.here.account here-aaa-sdk - 0.4.23 + 0.4.24-SNAPSHOT pom here-aaa-sdk is for clients of the HERE AAA, and demos grant_type=client_credentials http://github.com/heremaps/here-aaa-java-sdk From 35a5e65a230f3f3c31199ec9c8bf88232e7f7a16 Mon Sep 17 00:00:00 2001 From: here-aaa-sdk Date: Mon, 31 Jan 2022 11:14:20 -0500 Subject: [PATCH 07/15] Make 0.4.24 Release Signed-off-by: Ken McCracken --- examples/here-oauth-client-example/dependency-reduced-pom.xml | 2 +- examples/here-oauth-client-example/pom.xml | 2 +- here-oauth-client-dist/pom.xml | 2 +- here-oauth-client/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/here-oauth-client-example/dependency-reduced-pom.xml b/examples/here-oauth-client-example/dependency-reduced-pom.xml index 03942d59..8db335c9 100644 --- a/examples/here-oauth-client-example/dependency-reduced-pom.xml +++ b/examples/here-oauth-client-example/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ here-aaa-sdk com.here.account - 0.4.24-SNAPSHOT + 0.4.24 ../../pom.xml 4.0.0 diff --git a/examples/here-oauth-client-example/pom.xml b/examples/here-oauth-client-example/pom.xml index 1aeec749..7dfde2ef 100644 --- a/examples/here-oauth-client-example/pom.xml +++ b/examples/here-oauth-client-example/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.24-SNAPSHOT + 0.4.24 ../../pom.xml diff --git a/here-oauth-client-dist/pom.xml b/here-oauth-client-dist/pom.xml index e541d9c6..975ada1d 100644 --- a/here-oauth-client-dist/pom.xml +++ b/here-oauth-client-dist/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.24-SNAPSHOT + 0.4.24 ../pom.xml diff --git a/here-oauth-client/pom.xml b/here-oauth-client/pom.xml index 15cae67a..9893a86c 100644 --- a/here-oauth-client/pom.xml +++ b/here-oauth-client/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.24-SNAPSHOT + 0.4.24 ../pom.xml diff --git a/pom.xml b/pom.xml index 814cc347..e56b1ab8 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ HERE AAA Client SDK Parent POM com.here.account here-aaa-sdk - 0.4.24-SNAPSHOT + 0.4.24 pom here-aaa-sdk is for clients of the HERE AAA, and demos grant_type=client_credentials http://github.com/heremaps/here-aaa-java-sdk From 8056c6fe2185d02f067650780e815c83d5b14c1c Mon Sep 17 00:00:00 2001 From: here-aaa-sdk Date: Mon, 31 Jan 2022 12:01:22 -0500 Subject: [PATCH 08/15] Update to next release version 0.4.25-SNAPSHOT Signed-off-by: Ken McCracken --- examples/here-oauth-client-example/dependency-reduced-pom.xml | 2 +- examples/here-oauth-client-example/pom.xml | 2 +- here-oauth-client-dist/pom.xml | 2 +- here-oauth-client/pom.xml | 2 +- pom.xml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/examples/here-oauth-client-example/dependency-reduced-pom.xml b/examples/here-oauth-client-example/dependency-reduced-pom.xml index 8db335c9..9513f064 100644 --- a/examples/here-oauth-client-example/dependency-reduced-pom.xml +++ b/examples/here-oauth-client-example/dependency-reduced-pom.xml @@ -3,7 +3,7 @@ here-aaa-sdk com.here.account - 0.4.24 + 0.4.25-SNAPSHOT ../../pom.xml 4.0.0 diff --git a/examples/here-oauth-client-example/pom.xml b/examples/here-oauth-client-example/pom.xml index 7dfde2ef..d1b2a630 100644 --- a/examples/here-oauth-client-example/pom.xml +++ b/examples/here-oauth-client-example/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.24 + 0.4.25-SNAPSHOT ../../pom.xml diff --git a/here-oauth-client-dist/pom.xml b/here-oauth-client-dist/pom.xml index 975ada1d..9ae4e898 100644 --- a/here-oauth-client-dist/pom.xml +++ b/here-oauth-client-dist/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.24 + 0.4.25-SNAPSHOT ../pom.xml diff --git a/here-oauth-client/pom.xml b/here-oauth-client/pom.xml index 9893a86c..e636df68 100644 --- a/here-oauth-client/pom.xml +++ b/here-oauth-client/pom.xml @@ -9,7 +9,7 @@ com.here.account here-aaa-sdk - 0.4.24 + 0.4.25-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index e56b1ab8..7b4ef60d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ HERE AAA Client SDK Parent POM com.here.account here-aaa-sdk - 0.4.24 + 0.4.25-SNAPSHOT pom here-aaa-sdk is for clients of the HERE AAA, and demos grant_type=client_credentials http://github.com/heremaps/here-aaa-java-sdk From 2cde63e7195aa96091b15f1bf30ca6f5bba5113f Mon Sep 17 00:00:00 2001 From: Samuli Linden Date: Fri, 30 Sep 2022 15:15:58 +0300 Subject: [PATCH 09/15] Replace Travis CI with Github Workflows. Signed-off-by: Samuli Linden Signed-off-by: Ken McCracken --- .github/workflows/test.yml | 24 ++++++++++++++++++++++++ .travis.yml | 15 --------------- README.md | 2 -- 3 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..b9633b47 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,24 @@ +name: Run AAA SDK CI + +on: [push, pull_request, workflow_dispatch] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Cache local Maven repository + uses: actions/cache@v2 + with: + path: €HOME/.m2 + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- + - name: Setup Java + uses: actions/setup-java@v1 + with: + java-version: '8' + - name: Verify Maven installation + run: mvn version + - name: Run AAA SDK tests + run: mvn -Dhere.token.endpoint.url=$HERE_TOKEN_ENDPOINT_URL -Dhere.access.key.id=$ACCESS_KEY_ID -Dhere.access.key.secret=$ACCESS_KEY_SECRET clean install diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e73d26db..00000000 --- a/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: java -jdk: openjdk8 -cache: - directories: - - $HOME/.m2 -install: true -env: - global: - - HERE_TOKEN_ENDPOINT_URL="https://stg.account.api.here.com/oauth2/token" - - secure: t4JWkYSYbGS/c3JAazST1jmmi1OtZ07X0cmriFxQz0uLLJUifRF3wz2LaKbBC4RoW2reZaFiMon2gd5cy8HEaG1ZruoPzeHEMvsLe9QLegswj0U0d8k3V0Ncd9pknFL9/JI0RTAdCDQ28VfWX0PfY+5HDbYsixoF+9gZv3NED+3r772IqZTMkvhQEU7kT/AwcLXxw2fRr+iKjB7Qr5GLtZkHOhrPekX/4VQRRhTlImPDf4f3PdYawuBqZaLVATbqFedlE92m0tn6rtkHXRv/+rspWTprrBwmeuj6qPtVvTkI9kbvyaPLrHRvvPhROsf0iQuKsRGrO54jktZ/9lDTFhhkmkf4xYb2Hicpmh6soI/c4iR7niVDBDDseT8HonTgM+rtdgMBYeQnJrge0POUQTV1iSV8PCm5I1e1jN3ZTbY8S2bhEL55/UaB1MOf6rbEvxdBspE0Z2DBNHLZb7nML5+pJ3iNeuiYO2ujivTJMbiisEYxb3psF+tjNEfMfFlgwgX7d6julJeKpGSiwxBZWcmI02q8HZoC8f7DQhuw9Ybq0Qv5Akc7fmtY6acs1FlsO+z4sB5FqtEyvAH1OnqerEoRaL86ijAR4QcFINJJeoNWopzgGwBhL873dXFojSAMZ+6bS6OVO+C+pCrWCCeXXfmaafoytnC9Ev/wIO74NZ8= - - secure: AMWoPS0zBzIoyJR64QJh8IxZmhhjtdSH+T+2zQdUpQZqeUfIEEwIVlmkLwOiJWRKJcVALu+qUmrTfRwCtRRl5ed2GqWYqLpRDUJO6FP+nwowqyL0YA8wyWbxJ4PpD4T/8rfDRQ7vP+h2G/8B6+qbKfrsttsLay/wd+DzwxZWcxVgrcuIiRJ0aAj3BkLkIlvnVWcOxwnBvUcA89MlQF2UYE2VAoiaSve8RD1ZMbdb4tqBQLJbp1q8/3H4YFEbMoaqemBh24Heopsd4oxfI08fcCnwEagaeG/8dmV/jnd+wEURr126zgDOowgCKwWUolY4lcIeAeJbm7uMdNWJmnCTKiQHFM1M1w9zTuLrv0A56DeSBuXkVYWV1oDnerTPBRTxwcroSVc4n2L1az3U/j5vhshRerPU3EFpoyDKgaxUJpUQMC+Bjqqog/urZYDlcj2cuXMeuoTpciFGXjLCehhaM+9mdOmo1peT3fT2VaI844R8Yc4HsuDmE+SoHUPSVF0JxUQVNDVBU7KGqpXeGUyEVewFWLiBdtx2aLd3Jy1PxUT7MxDleyOIdIhkEGMGytmyISXPm5nMRfLfFzwe93x7nOEV7PBSKOQprGYHMKh4X7QQ1wQosZekUb6FP30xaRevGgHkmnzMCzPAd+uX84IywqPLrVcZANQq4KpS3KUkuUw= - -script: - - mvn -version - - mvn -Dhere.token.endpoint.url=$HERE_TOKEN_ENDPOINT_URL -Dhere.access.key.id=$ACCESS_KEY_ID -Dhere.access.key.secret=$ACCESS_KEY_SECRET clean install diff --git a/README.md b/README.md index ce5e187e..a9d89c50 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,3 @@ -[![Build Status](https://travis-ci.com/heremaps/here-aaa-java-sdk.svg?branch=master)](https://travis-ci.com/heremaps/here-aaa-java-sdk) - HERE Authentication, Authorization, and Accounting Introduction From 0eb484f170d284f5f182d313559efbe93bbecaf4 Mon Sep 17 00:00:00 2001 From: Samuli Linden Date: Tue, 4 Oct 2022 11:57:13 +0300 Subject: [PATCH 10/15] Fixing typo. Signed-off-by: Samuli Linden Signed-off-by: Ken McCracken --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b9633b47..0e418376 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: - name: Cache local Maven repository uses: actions/cache@v2 with: - path: €HOME/.m2 + path: $HOME/.m2 key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} restore-keys: | ${{ runner.os }}-maven- From 33fb5d4819a9636e704dcdd75b775ae8f581b3f0 Mon Sep 17 00:00:00 2001 From: Samuli Linden Date: Tue, 4 Oct 2022 13:13:07 +0300 Subject: [PATCH 11/15] Changing mvn version to mvn -v. Signed-off-by: Samuli Linden Signed-off-by: Ken McCracken --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0e418376..cfb5989a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -19,6 +19,6 @@ jobs: with: java-version: '8' - name: Verify Maven installation - run: mvn version + run: mvn -v - name: Run AAA SDK tests run: mvn -Dhere.token.endpoint.url=$HERE_TOKEN_ENDPOINT_URL -Dhere.access.key.id=$ACCESS_KEY_ID -Dhere.access.key.secret=$ACCESS_KEY_SECRET clean install From e4c4241249b56b98a7f65b975ee35bfd9fcae90b Mon Sep 17 00:00:00 2001 From: Samuli Linden Date: Thu, 6 Oct 2022 13:54:49 +0300 Subject: [PATCH 12/15] Update Workflows to use repository secrets and the correct endpoint URL. Signed-off-by: Ken McCracken --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cfb5989a..b702dc69 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,4 +21,4 @@ jobs: - name: Verify Maven installation run: mvn -v - name: Run AAA SDK tests - run: mvn -Dhere.token.endpoint.url=$HERE_TOKEN_ENDPOINT_URL -Dhere.access.key.id=$ACCESS_KEY_ID -Dhere.access.key.secret=$ACCESS_KEY_SECRET clean install + run: mvn -Dhere.token.endpoint.url=https://stg.account.api.here.com/oauth2/token -Dhere.access.key.id=${{ secrets.ACCESS_KEY_ID }} -Dhere.access.key.secret=${{ secrets.ACCESS_KEY_SECRET }} clean install \ No newline at end of file From 294e27b9b6285af87485774042cad0e457d7149e Mon Sep 17 00:00:00 2001 From: Samuli Linden Date: Thu, 6 Oct 2022 15:46:10 +0300 Subject: [PATCH 13/15] OLPSUP-20170 Updating dependencies to fix a security vulnerability. Signed-off-by: Samuli Linden Signed-off-by: Ken McCracken --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 7b4ef60d..149be5fb 100644 --- a/pom.xml +++ b/pom.xml @@ -64,9 +64,9 @@ 2.19.1 - 4.5.2 + 4.5.13 0.5.1 - 2.10.0.pr1 + 2.13.3 4.13.1 1.10.19 1.8.17 From 0fa1638f26c422d286bf3ad6701395dcbedd469f Mon Sep 17 00:00:00 2001 From: vyshniak Date: Tue, 18 Oct 2022 14:52:14 +0300 Subject: [PATCH 14/15] Fix CVE-2022-41404 Signed-off-by: Oleksandr Vyshniak Signed-off-by: Ken McCracken --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 149be5fb..0764f2e9 100644 --- a/pom.xml +++ b/pom.xml @@ -65,7 +65,7 @@ 4.5.13 - 0.5.1 + 0.5.4 2.13.3 4.13.1 1.10.19 From 1df52992fc01d35fb4bb3c356fe67d418b11b137 Mon Sep 17 00:00:00 2001 From: Ken McCracken Date: Fri, 21 Oct 2022 14:37:48 -0400 Subject: [PATCH 15/15] add a test that could generate negative with the old code. Signed-off-by: Ken McCracken --- .../Socket5xxExponentialRandomBackoffPolicy.java | 3 ++- .../Socket5xxExponentialRandomBackoffPolicyTest.java | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java b/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java index 84be535d..6e284ae6 100644 --- a/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java +++ b/here-oauth-client/src/main/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicy.java @@ -52,6 +52,7 @@ public boolean shouldRetry(RetryContext retryContext) { public int getNextRetryIntervalMillis(RetryContext retryContext){ int retryCount = retryContext.getRetryCount(); int factor = Math.min(1 << (Math.min(retryCount, 30)), maxRetryFactor); - return retryIntervalMillis * ThreadLocalRandom.current().nextInt(factor); + long value = ((long) retryIntervalMillis) * ThreadLocalRandom.current().nextInt(factor); + return (int) Math.min(Integer.MAX_VALUE, value); } } diff --git a/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java b/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java index 58d5ce50..fc9ca27d 100644 --- a/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java +++ b/here-oauth-client/src/test/java/com/here/account/oauth2/retry/Socket5xxExponentialRandomBackoffPolicyTest.java @@ -22,6 +22,18 @@ public void setUp() { maxRetryFactor); } + @Test + public void test_largeRetryCount_notNegative() { + for (int j = 0; j < 10; j++) { + RetryContext retryContext = new RetryContext(); + for (int i = 0; i < 40; i++) { + retryContext.incrementRetryCount(); + int nextRetryIntervalMillis = socket5xxExponentialRandomBackoffPolicy.getNextRetryIntervalMillis(retryContext); + assertTrue("i=" + i + ", retryContext.getRetryCount()=" + retryContext.getRetryCount() + ", nextRetryIntervalMillis was negative " + nextRetryIntervalMillis, nextRetryIntervalMillis >= 0); + } + } + } + @Test public void test_shouldRetry() { HttpProvider.HttpResponse httpResponse = Mockito.mock(HttpProvider.HttpResponse.class);