Skip to content

Commit

Permalink
Merge pull request #198 from yahoo/notfound
Browse files Browse the repository at this point in the history
correct handling for getSignedDomains when domain name is not found
  • Loading branch information
havetisyan authored Aug 3, 2017
2 parents 6a10147 + 2190f6a commit 2cd19d2
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions servers/zms/src/main/java/com/yahoo/athenz/zms/ZMSImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -4063,20 +4063,37 @@ public void getSignedDomains(ResourceContext ctx, String domainName, String meta

if (domainName != null && !domainName.isEmpty()) {

Domain domain = dbService.getDomain(domainName, masterCopy);
long lastModifiedTime = domain.getModified().millis();
if (timestamp != 0 && lastModifiedTime <= timestamp) {
EntityTag eTag = new EntityTag(domain.getModified().toString());
result.done(304, eTag.toString());
Domain domain = null;
try {
domain = dbService.getDomain(domainName, masterCopy);
} catch (ResourceException ex) {

// in case the domain does not exist we're just
// going to return an empty set

if (ex.getCode() != ResourceException.NOT_FOUND) {
throw ex;
}
}

// generate our signed domain object

SignedDomain signedDomain = retrieveSignedDomain(domainName, lastModifiedTime,
setMetaDataOnly);

if (signedDomain != null) {
sdList.add(signedDomain);
if (domain != null) {
youngestDomMod = domain.getModified().millis();

if (timestamp != 0 && youngestDomMod <= timestamp) {
EntityTag eTag = new EntityTag(domain.getModified().toString());
result.done(304, eTag.toString());
}

// generate our signed domain object

SignedDomain signedDomain = retrieveSignedDomain(domainName, youngestDomMod,
setMetaDataOnly);

if (signedDomain != null) {
sdList.add(signedDomain);
}
} else {
youngestDomMod = System.currentTimeMillis();
}

} else {
Expand Down

0 comments on commit 2cd19d2

Please sign in to comment.