HDFS-14009. HttpFS: FileStatus#setSnapShotEnabledFlag throws InvocationTargetException when attribute set is emptySet. Contributed by Siyao Meng.
Signed-off-by: Wei-Chiu Chuang <weichiu@apache.org>
This commit is contained in:
parent
b34c650a41
commit
6a7bf9f850
|
@ -360,7 +360,11 @@ public class FileStatus implements Writable, Comparable<Object>,
|
||||||
*/
|
*/
|
||||||
public void setSnapShotEnabledFlag(boolean isSnapShotEnabled) {
|
public void setSnapShotEnabledFlag(boolean isSnapShotEnabled) {
|
||||||
if (isSnapShotEnabled) {
|
if (isSnapShotEnabled) {
|
||||||
|
if (attr == NONE) {
|
||||||
|
attr = EnumSet.of(AttrFlags.SNAPSHOT_ENABLED);
|
||||||
|
} else {
|
||||||
attr.add(AttrFlags.SNAPSHOT_ENABLED);
|
attr.add(AttrFlags.SNAPSHOT_ENABLED);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
attr.remove(AttrFlags.SNAPSHOT_ENABLED);
|
attr.remove(AttrFlags.SNAPSHOT_ENABLED);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue