Skip to content

Commit 158c072

Browse files
author
rathnapandi
committed
- Fix #588
1 parent dcf7ca6 commit 158c072

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

modules/apim-adapter/src/main/java/com/axway/apim/adapter/apis/APIManagerQuotaAdapter.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,16 @@ public APIManagerQuotaAdapter(APIManagerAdapter apiManagerAdapter) {
8080

8181
private void readQuotaFromAPIManager(String quotaId) throws AppException {
8282
if (!APIManagerAdapter.getInstance().hasAdminAccount()) return;
83-
if (this.apiManagerResponse.get(quotaId) != null) return;
83+
if (apiManagerResponse.get(quotaId) != null) return;
8484
URI uri;
8585
try {
8686
if (Quota.APPLICATION_DEFAULT.getQuotaId().equals(quotaId) || Quota.SYSTEM_DEFAULT.getQuotaId().equals(quotaId)) {
8787
uri = new URIBuilder(cmd.getAPIManagerURL()).setPath(cmd.getApiBasepath() + "/quotas/" + quotaId).build();
8888
} else {
8989
if (applicationsQuotaCache.containsKey(quotaId)) {
90-
if(LOG.isDebugEnabled())
90+
if (LOG.isDebugEnabled())
9191
LOG.debug("Found quota with ID: {} in cache: {}", quotaId, applicationsQuotaCache.get(quotaId));
92-
this.apiManagerResponse.put(quotaId, applicationsQuotaCache.get(quotaId));
92+
apiManagerResponse.put(quotaId, applicationsQuotaCache.get(quotaId));
9393
return;
9494
}
9595
uri = new URIBuilder(cmd.getAPIManagerURL()).setPath(cmd.getApiBasepath() + "/applications/" + quotaId + "/quota/").build();
@@ -102,7 +102,7 @@ private void readQuotaFromAPIManager(String quotaId) throws AppException {
102102
if (statusCode != 200) {
103103
throw new AppException("Can't read API-Manager Quota-Configuration. Got status code: " + statusCode + " for request: " + uri, ErrorCode.API_MANAGER_COMMUNICATION);
104104
}
105-
this.apiManagerResponse.put(quotaId, response);
105+
apiManagerResponse.put(quotaId, response);
106106
if (!Quota.APPLICATION_DEFAULT.getQuotaId().equals(quotaId) && !Quota.SYSTEM_DEFAULT.getQuotaId().equals(quotaId)) {
107107
applicationsQuotaCache.put(quotaId, response);
108108
}
@@ -152,7 +152,7 @@ public void saveQuota(APIQuota quotaConfig, String quotaId) throws AppException
152152
String response = httpResponse.getResponseBody();
153153
if (statusCode < 200 || statusCode > 299) {
154154
if ((statusCode == 400 && response.contains("API not found"))
155-
|| (statusCode == 500 && response.contains("Internal server error"))
155+
|| (statusCode == 500 && response.contains("Internal server error") || statusCode == 102 && response.contains("Quota constraint not found"))
156156
) {
157157
LOG.warn("Got unexpected error while saving quota configuration ... Try again in {} milliseconds. (you may set -retryDelay <milliseconds>)", cmd.getRetryDelay());
158158
Thread.sleep(cmd.getRetryDelay());
@@ -166,7 +166,7 @@ public void saveQuota(APIQuota quotaConfig, String quotaId) throws AppException
166166
mapper.readValue(response, APIQuota.class);
167167
} catch (IOException | URISyntaxException e) {
168168
throw new AppException("Can't update Quota-Configuration in API-Manager.", ErrorCode.UNXPECTED_ERROR, e);
169-
}catch (InterruptedException e) {
169+
} catch (InterruptedException e) {
170170
Thread.currentThread().interrupt();
171171
}
172172
}

0 commit comments

Comments
 (0)