Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging the error instead of throwing as exception #66

Merged
merged 2 commits into from
Apr 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
logReplicationEventInfoStatement("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