repository.getAttributesHandler().touchItemLastRequested(System.currentTimeMillis(), link);
}
catch (NoSuchRepositoryException e) {
log.warn("Stale link object found on UID: {}, deleting it.", uid);
DirSupport.delete(target.toPath());
throw new ItemNotFoundException(reasonFor(request, repository,
"Path %s not found in local storage of repository %s", request.getRequestPath(),
RepositoryStringUtils.getHumanizedNameString(repository)), e);
}
}
else {
DefaultStorageFileItem file =
new DefaultStorageFileItem(repository, request, target.canRead(), target.canWrite(),
fileContent);
repository.getAttributesHandler().fetchAttributes(file);
file.setModified(target.lastModified());
file.setCreated(target.lastModified());
result = file;
repository.getAttributesHandler().touchItemLastRequested(System.currentTimeMillis(), file);
}
}
catch (FileNotFoundException e) {
// It is possible for this file to have been removed after the call to target.exists()
// this could have been an external process
// See: https://issues.sonatype.org/browse/NEXUS-4570
log.debug("File '{}' removed before finished processing the directory listing", target, e);
throw new ItemNotFoundException(reasonFor(request, repository,
"Path %s not found in local storage of repository %s", request.getRequestPath(),
RepositoryStringUtils.getHumanizedNameString(repository)), e);
}
catch (IOException e) {
throw new LocalStorageException("Exception during reading up an item from FS storage!", e);
}
}
else {
throw new ItemNotFoundException(reasonFor(request, repository,
"Path %s not found in local storage of repository %s", request.getRequestPath(),
RepositoryStringUtils.getHumanizedNameString(repository)));
}
return result;