From e4cd67e9b0bcc4e5aedb8c189dc780326c69b032 Mon Sep 17 00:00:00 2001 From: yliu Date: Tue, 31 Mar 2015 21:16:13 +0800 Subject: [PATCH] HDFS-7997. The first non-existing xattr should also throw IOException. (zhouyingchao via yliu) --- hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt | 3 +++ .../org/apache/hadoop/hdfs/server/namenode/FSDirXAttrOp.java | 3 ++- .../hadoop-hdfs/src/test/resources/testXAttrConf.xml | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt index 3d7690ecd35..da3d729a5db 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt +++ b/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt @@ -77,6 +77,9 @@ Release 2.8.0 - UNRELEASED DatanodeDescriptor#updateHeartbeatState() (Brahma Reddy Battula via Colin P. McCabe) + HDFS-7997. The first non-existing xattr should also throw IOException. + (zhouyingchao via yliu) + Release 2.7.0 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirXAttrOp.java b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirXAttrOp.java index 45e63f2effe..d5c91241662 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirXAttrOp.java +++ b/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSDirXAttrOp.java @@ -108,7 +108,8 @@ class FSDirXAttrOp { return filteredAll; } if (filteredAll == null || filteredAll.isEmpty()) { - return null; + throw new IOException( + "At least one of the attributes provided was not found."); } List toGet = Lists.newArrayListWithCapacity(xAttrs.size()); for (XAttr xAttr : xAttrs) { diff --git a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testXAttrConf.xml b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testXAttrConf.xml index 9c66cba8487..c2e836c58b0 100644 --- a/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testXAttrConf.xml +++ b/hadoop-hdfs-project/hadoop-hdfs/src/test/resources/testXAttrConf.xml @@ -420,8 +420,8 @@ - ExactComparator - # file: /file1#LF# + SubstringComparator + At least one of the attributes provided was not found