Repository: hadoop Updated Branches: refs/heads/branch-3.0 b34c650a4 -> 6a7bf9f85
HDFS-14009. HttpFS: FileStatus#setSnapShotEnabledFlag throws InvocationTargetException when attribute set is emptySet. Contributed by Siyao Meng. Signed-off-by: Wei-Chiu Chuang <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6a7bf9f8 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6a7bf9f8 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6a7bf9f8 Branch: refs/heads/branch-3.0 Commit: 6a7bf9f850b560eb01b2db78d04446c74b443b8f Parents: b34c650 Author: Siyao Meng <[email protected]> Authored: Thu Oct 18 17:02:04 2018 -0700 Committer: Wei-Chiu Chuang <[email protected]> Committed: Thu Oct 18 17:02:38 2018 -0700 ---------------------------------------------------------------------- .../src/main/java/org/apache/hadoop/fs/FileStatus.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/6a7bf9f8/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileStatus.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileStatus.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileStatus.java index bdfbd20..4d953c6 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileStatus.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/FileStatus.java @@ -360,7 +360,11 @@ public class FileStatus implements Writable, Comparable<Object>, */ public void setSnapShotEnabledFlag(boolean isSnapShotEnabled) { if (isSnapShotEnabled) { - attr.add(AttrFlags.SNAPSHOT_ENABLED); + if (attr == NONE) { + attr = EnumSet.of(AttrFlags.SNAPSHOT_ENABLED); + } else { + attr.add(AttrFlags.SNAPSHOT_ENABLED); + } } else { attr.remove(AttrFlags.SNAPSHOT_ENABLED); } --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
