JCLOUDS-1218: filesystem get blob without xattrs

Some filesystems, notably Docker and Mac OS X, do not support xattr
which causes an IOException when getting a blob.
This commit is contained in:
Geert Vanheusden 2017-02-28 19:30:20 +01:00 committed by Andrew Gaul
parent f76c09cbe6
commit f210283cac
1 changed files with 29 additions and 25 deletions

View File

@ -346,6 +346,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(file.toPath());
if (view != null) {
try {
Set<String> attributes = ImmutableSet.copyOf(view.list());
cacheControl = readStringAttributeIfPresent(view, attributes, XATTR_CACHE_CONTROL);
@ -374,6 +375,9 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
String value = readStringAttributeIfPresent(view, attributes, attribute);
userMetadata.put(attribute.substring(XATTR_USER_METADATA_PREFIX.length()), value);
}
} catch (IOException e) {
logger.debug("xattrs not supported on %s", file.toPath());
}
builder.payload(byteSource)
.cacheControl(cacheControl)