Skip to content

Commit 8dfce6b

Browse files
author
Chris Wiechmann
committed
Also retry REST-Call, if response contains: The entity could not be found
closes #218
1 parent 198d5b4 commit 8dfce6b

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public APIAccess createAPIAccess(APIAccess apiAccess, AbstractEntity parentEntit
193193
int statusCode = httpResponse.getStatusLine().getStatusCode();
194194
String response = EntityUtils.toString(httpResponse.getEntity());
195195
if(statusCode < 200 || statusCode > 299){
196-
if((statusCode==403 || statusCode==404) && response.contains("Unknown API")) {
196+
if((statusCode==403 || statusCode==404) && (response.contains("Unknown API") || response.contains("The entity could not be found")) ) {
197197
LOG.warn("Got unexpected error: 'Unknown API' while creating API-Access ... Try again in "+cmd.getRetryDelay()+" milliseconds. (you may set -retryDelay <milliseconds>)");
198198
Thread.sleep(cmd.getRetryDelay());
199199
httpResponse = request.execute();

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ public API createAPIProxy(API api) throws AppException {
593593
}
594594

595595
public API updateAPIProxy(API api) throws AppException {
596-
LOG.debug("Updating API-Proxy");
596+
LOG.debug("Updating API-Proxy: '"+api.getName()+" "+api.getVersion()+" ("+api.getId()+")'" );
597597
URI uri;
598598
HttpEntity entity;
599599
mapper.setSerializationInclusion(Include.NON_NULL);
@@ -1000,7 +1000,7 @@ public boolean upgradeAccessToNewerAPI(API apiToUpgradeAccess, API referenceAPI,
10001000
+ "reference/old API: "+Utils.getAPILogString(referenceAPI)+" are the same. Skip upgrade access to newer API.");
10011001
return false;
10021002
}
1003-
LOG.debug("Upgrade access & subscriptions to API: " + apiToUpgradeAccess.getName() + " " + apiToUpgradeAccess.getVersion() + "("+apiToUpgradeAccess.getId()+")");
1003+
LOG.debug("Upgrade access & subscriptions to API: " + apiToUpgradeAccess.getName() + " " + apiToUpgradeAccess.getVersion() + " ("+apiToUpgradeAccess.getId()+")");
10041004

10051005
URI uri;
10061006
HttpEntity entity;
@@ -1023,7 +1023,7 @@ public boolean upgradeAccessToNewerAPI(API apiToUpgradeAccess, API referenceAPI,
10231023
int statusCode = httpResponse.getStatusLine().getStatusCode();
10241024
if(statusCode != 204){
10251025
String response = EntityUtils.toString(httpResponse.getEntity());
1026-
if((statusCode==403 || statusCode==404) && response.contains("Unknown API")) {
1026+
if((statusCode==403 || statusCode==404) && (response.contains("Unknown API") || response.contains("The entity could not be found")) ) {
10271027
LOG.warn("Got unexpected error: 'Unknown API' while granting access to newer API ... Try again in "+cmd.getRetryDelay()+" milliseconds. (you may set -retryDelay <milliseconds>)");
10281028
Thread.sleep(cmd.getRetryDelay());
10291029
httpResponse = request.execute();

0 commit comments

Comments
 (0)