diff --git a/vault/src/main/java/org/opencadc/vault/NodePersistenceImpl.java b/vault/src/main/java/org/opencadc/vault/NodePersistenceImpl.java index ace723d0..54dd0348 100644 --- a/vault/src/main/java/org/opencadc/vault/NodePersistenceImpl.java +++ b/vault/src/main/java/org/opencadc/vault/NodePersistenceImpl.java @@ -498,7 +498,7 @@ public ResourceIterator iterator(ContainerNode parent, Integer limit, Stri private class ChildNodeWrapper implements ResourceIterator { private final ContainerNode parent; - private final ResourceIterator childIter; + private ResourceIterator childIter; private boolean closedForException = false; private final IdentityManager identityManager = AuthenticationUtil.getIdentityManager(); diff --git a/vault/src/main/java/org/opencadc/vault/files/GetAction.java b/vault/src/main/java/org/opencadc/vault/files/GetAction.java index 7d740d7d..f4dd2895 100644 --- a/vault/src/main/java/org/opencadc/vault/files/GetAction.java +++ b/vault/src/main/java/org/opencadc/vault/files/GetAction.java @@ -111,7 +111,7 @@ public void doAction() throws Exception { boolean noArtifact = node.bytesUsed == null || node.bytesUsed == 0L; noArtifact = noArtifact && nodePersistence.preventNotFound && rn.artifact == null; if (noArtifact) { - // no file + // no artifact found by preventNotFound syncOutput.setCode(HttpURLConnection.HTTP_NO_CONTENT); return; } @@ -126,6 +126,14 @@ public void doAction() throws Exception { rn.protos = tg.getEndpoints(targetURI, pullTransfer, null); rn.artifact = tg.resolvedArtifact; // currently unused at this point } + // check artifact again (!preventNotFound) + noArtifact = node.bytesUsed == null || node.bytesUsed == 0L; + noArtifact = noArtifact && rn.artifact == null; + if (noArtifact) { + // no file + syncOutput.setCode(HttpURLConnection.HTTP_NO_CONTENT); + return; + } if (rn.protos.isEmpty()) { throw new TransientException("No location found for file " + Utils.getPath(node)); diff --git a/vault/src/main/java/org/opencadc/vault/metadata/BackgroundLogInfo.java b/vault/src/main/java/org/opencadc/vault/metadata/BackgroundLogInfo.java index 88ac11a9..92e0752e 100644 --- a/vault/src/main/java/org/opencadc/vault/metadata/BackgroundLogInfo.java +++ b/vault/src/main/java/org/opencadc/vault/metadata/BackgroundLogInfo.java @@ -98,9 +98,11 @@ public void setOperation(String op) { } public void setLastModified(Date ts) { - DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC); - this.lastmodified = df.format(ts); + if (ts != null) { + DateFormat df = DateUtil.getDateFormat(DateUtil.IVOA_DATE_FORMAT, DateUtil.UTC); + this.lastmodified = df.format(ts); + } else { + this.lastmodified = null; + } } - - }