Skip to content

Commit

Permalink
bugfix for StackoverflowError: remove progressListener implementation…
Browse files Browse the repository at this point in the history
  • Loading branch information
felixebert committed Feb 9, 2023
1 parent 0c25400 commit c24bb44
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 22 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Attach sources to jar
* Fix Bug in SignableRequestImpl
* Define ItemAttributes of Catalog API as hashmap containing arrays of jsonObjects
* bugfix for stackoverflow error caused by networkInterceptors in async methods

## Selling Partner API Models
This repository contains Swagger models for developers to use to create software to call Selling Partner APIs. Developers can use [swagger codegen](https://github.com/swagger-api/swagger-codegen) to generate client libraries from these models. Please refer to [selling-partner-api-docs](https://github.com/amzn/selling-partner-api-docs) for additional documentation and read the [Selling Partner API Developer Guide](https://github.com/amzn/selling-partner-api-docs/blob/main/guides/en-US/developer-guide/SellingPartnerApiDeveloperGuide.md) for instructions to get started.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,18 +123,6 @@ public class {{classname}} {
final String {{localVariablePrefix}}localVarContentType = {{localVariablePrefix}}apiClient.selectHeaderContentType({{localVariablePrefix}}localVarContentTypes);
{{localVariablePrefix}}localVarHeaderParams.put("Content-Type", {{localVariablePrefix}}localVarContentType);

if(progressListener != null) {
apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() {
@Override
public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException {
com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request());
return originalResponse.newBuilder()
.body(new ProgressResponseBody(originalResponse.body(), progressListener))
.build();
}
});
}

String[] {{localVariablePrefix}}localVarAuthNames = new String[] { {{#authMethods}}"{{name}}"{{#hasMore}}, {{/hasMore}}{{/authMethods}} };
return {{localVariablePrefix}}apiClient.buildCall({{localVariablePrefix}}localVarPath, "{{httpMethod}}", {{localVariablePrefix}}localVarQueryParams, {{localVariablePrefix}}localVarCollectionQueryParams, {{localVariablePrefix}}localVarPostBody, {{localVariablePrefix}}localVarHeaderParams, {{localVariablePrefix}}localVarFormParams, {{localVariablePrefix}}localVarAuthNames, progressRequestListener);
}
Expand Down Expand Up @@ -298,32 +286,32 @@ public class {{classname}} {
this.endpoint = endpoint;
return this;
}

public Builder lwaAccessTokenCache(LWAAccessTokenCache lwaAccessTokenCache) {
this.lwaAccessTokenCache = lwaAccessTokenCache;
return this;
}

public Builder disableAccessTokenCache() {
this.disableAccessTokenCache = true;
return this;
}

public Builder awsAuthenticationCredentialsProvider(AWSAuthenticationCredentialsProvider awsAuthenticationCredentialsProvider) {
this.awsAuthenticationCredentialsProvider = awsAuthenticationCredentialsProvider;
return this;
}

public Builder rateLimitConfigurationOnRequests(RateLimitConfiguration rateLimitConfiguration){
this.rateLimitConfiguration = rateLimitConfiguration;
return this;
}

public Builder disableRateLimitOnRequests() {
this.rateLimitConfiguration = null;
return this;
}


public {{classname}} build() {
if (awsAuthenticationCredentials == null) {
Expand All @@ -345,14 +333,14 @@ public class {{classname}} {
else {
awsSigV4Signer = new AWSSigV4Signer(awsAuthenticationCredentials,awsAuthenticationCredentialsProvider);
}
LWAAuthorizationSigner lwaAuthorizationSigner = null;

LWAAuthorizationSigner lwaAuthorizationSigner = null;
if (disableAccessTokenCache) {
lwaAuthorizationSigner = new LWAAuthorizationSigner(lwaAuthorizationCredentials);
}
else {
if (lwaAccessTokenCache == null) {
lwaAccessTokenCache = new LWAAccessTokenCacheImpl();
lwaAccessTokenCache = new LWAAccessTokenCacheImpl();
}
lwaAuthorizationSigner = new LWAAuthorizationSigner(lwaAuthorizationCredentials,lwaAccessTokenCache);
}
Expand All @@ -365,4 +353,4 @@ public class {{classname}} {
}
}
}
{{/operations}}
{{/operations}}

0 comments on commit c24bb44

Please sign in to comment.