Skip to content

Commit

Permalink
Logging the error instead of throwing as exception
Browse files Browse the repository at this point in the history
  • Loading branch information
Seenivasa Ragavan authored and Seenivasa Ragavan committed Apr 12, 2021
1 parent 43f6878 commit 6c3f95f
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,13 @@ private ReplicationResult handleRequest(ReplicationTransaction tx) throws Replic
private StringEntity createPostBody(ReplicationTransaction tx, String domain, String protocol, String additionalTrimPath, String[] excludepaths) throws ReplicationException {

JsonArray requestedJson = getPathsList(tx, domain, protocol, additionalTrimPath, excludepaths);

JsonObject json = new JsonObject();
if (requestedJson.size() > 0) {
JsonObject json = new JsonObject();
json.add("objects", requestedJson);
return new StringEntity(json.toString(), CharEncoding.ISO_8859_1);
} else {
throw new ReplicationException("No paths to purge");
currentReplicationLog.info("No paths to purge");
}

return new StringEntity(json.toString(), CharEncoding.ISO_8859_1);
}

/**
Expand Down Expand Up @@ -286,6 +284,11 @@ private JsonArray getPathsList(ReplicationTransaction tx, String domain, String
jsonArray.add(MessageFormat.format("{0}://{1}{2}", protocol, domain, pathAfter));
}
}

// checks for empty ulr list and adds the akamai home page url.
if(jsonArray.size() == 0) {
jsonArray.add(MessageFormat.format("{0}://{1}{2}", protocol, domain, StringUtils.EMPTY));
}
}

} catch (Exception e) {
Expand Down

0 comments on commit 6c3f95f

Please sign in to comment.