mirror of https://github.com/apache/jclouds.git
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:
parent
f76c09cbe6
commit
f210283cac
|
@ -346,6 +346,7 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
|
|
||||||
UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(file.toPath());
|
UserDefinedFileAttributeView view = getUserDefinedFileAttributeView(file.toPath());
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
|
try {
|
||||||
Set<String> attributes = ImmutableSet.copyOf(view.list());
|
Set<String> attributes = ImmutableSet.copyOf(view.list());
|
||||||
|
|
||||||
cacheControl = readStringAttributeIfPresent(view, attributes, XATTR_CACHE_CONTROL);
|
cacheControl = readStringAttributeIfPresent(view, attributes, XATTR_CACHE_CONTROL);
|
||||||
|
@ -374,6 +375,9 @@ public class FilesystemStorageStrategyImpl implements LocalStorageStrategy {
|
||||||
String value = readStringAttributeIfPresent(view, attributes, attribute);
|
String value = readStringAttributeIfPresent(view, attributes, attribute);
|
||||||
userMetadata.put(attribute.substring(XATTR_USER_METADATA_PREFIX.length()), value);
|
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)
|
builder.payload(byteSource)
|
||||||
.cacheControl(cacheControl)
|
.cacheControl(cacheControl)
|
||||||
|
|
Loading…
Reference in New Issue