diff --git a/cadc-storage-adapter-fs/build.gradle b/cadc-storage-adapter-fs/build.gradle index 1269afb7..d779a977 100644 --- a/cadc-storage-adapter-fs/build.gradle +++ b/cadc-storage-adapter-fs/build.gradle @@ -16,7 +16,7 @@ apply from: '../opencadc.gradle' group = 'org.opencadc' -version = '0.9.4' +version = '0.9.5' description = 'OpenCADC Storage Inventory FileSystem StorageAdapter implementation' def git_url = 'https://github.com/opencadc/storage-inventory' diff --git a/cadc-storage-adapter-fs/src/main/java/org/opencadc/inventory/storage/fs/OpaqueFileSystemStorageAdapter.java b/cadc-storage-adapter-fs/src/main/java/org/opencadc/inventory/storage/fs/OpaqueFileSystemStorageAdapter.java index 1cf219e2..00475ad6 100644 --- a/cadc-storage-adapter-fs/src/main/java/org/opencadc/inventory/storage/fs/OpaqueFileSystemStorageAdapter.java +++ b/cadc-storage-adapter-fs/src/main/java/org/opencadc/inventory/storage/fs/OpaqueFileSystemStorageAdapter.java @@ -926,6 +926,16 @@ static StorageMetadata createStorageMetadata(Path base, Path p, boolean includeR try { String csAttr = getFileAttribute(p, OpaqueFileSystemStorageAdapter.CHECKSUM_ATTR); String aidAttr = getFileAttribute(p, OpaqueFileSystemStorageAdapter.ARTIFACTID_ATTR); + if (csAttr == null || aidAttr == null) { + // this could happen if some were to copy files or the whole filesystem to + // a new storage area and not preserve xattrs (eg rsync without -X/--xattrs) + + // for now, just warn and skip so the operator has a chance to correct + log.warn("SKIP invalid: " + sloc + " : missing required attribute(s)" + + " " + OpaqueFileSystemStorageAdapter.CHECKSUM_ATTR + "=" + csAttr + + " " + OpaqueFileSystemStorageAdapter.ARTIFACTID_ATTR + "=" + aidAttr); + return null; + } URI contentChecksum = new URI(csAttr); long contentLength = Files.size(p); URI artifactURI = new URI(aidAttr);