diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a35649f5..6954be87 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.0-all.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/settings.gradle b/settings.gradle index ce6009d4..5003592a 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,7 +4,7 @@ dependencyResolutionManagement { versionCatalogs { libs { // main sdk version - version('sdk', '1.9.0'); + version('sdk', '1.9.1'); // sdk deps version('okhttp3', '4.12.0') diff --git a/src/main/java/io/harness/cf/client/connector/NewRetryInterceptor.java b/src/main/java/io/harness/cf/client/connector/NewRetryInterceptor.java index 110b4a69..2441a18e 100644 --- a/src/main/java/io/harness/cf/client/connector/NewRetryInterceptor.java +++ b/src/main/java/io/harness/cf/client/connector/NewRetryInterceptor.java @@ -70,7 +70,7 @@ public Response intercept(@NotNull Chain chain) throws IOException { String.format( Locale.getDefault(), "httpCode=%d %s", response.code(), response.message()); if (!shouldRetryHttpErrorCode(response.code())) { - return response; + return getReturnResp(chain, response, "nullcheck: shouldRetryHttpErrorCode is false"); } } else if (tryCount > 1) { log.info( @@ -83,7 +83,7 @@ public Response intercept(@NotNull Chain chain) throws IOException { response = makeErrorResp(chain, msg); successful = false; if (!shouldRetryException(ex)) { - return response; + return getReturnResp(chain, response, "nullcheck: shouldRetryException is false"); } } @@ -110,7 +110,8 @@ public Response intercept(@NotNull Chain chain) throws IOException { tryCount, chain.request().url(), msg); - return response; // Exit without further retries + return getReturnResp( + chain, response, "nullcheck: isShuttingDown is true"); // Exit without further retries } log.warn( @@ -134,7 +135,21 @@ public Response intercept(@NotNull Chain chain) throws IOException { tryCount++; } while (!successful && (retryForever || tryCount <= maxTryCount) && !isShuttingDown.get()); - return response; + return getReturnResp( + chain, + response, + String.format( + "nullcheck: exit loop successful=%s, retryForever=%s tryCount=%d maxTryCount=%d shutdown=%s", + successful, retryForever, tryCount, maxTryCount, isShuttingDown.get())); + } + + // interceptor should never return null, create dummy resp and embed an error msg if it does + private Response getReturnResp(Chain chain, Response resp, String msg) { + if (resp != null) { + return resp; + } + + return makeErrorResp(chain, String.format(msg, "%s url: %s", chain.request().url())); } int getRetryAfterHeaderInSeconds(Response response) {