Return-Path: X-Original-To: apmail-hadoop-common-commits-archive@www.apache.org Delivered-To: apmail-hadoop-common-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 0E65B11D8F for ; Mon, 5 May 2014 15:59:25 +0000 (UTC) Received: (qmail 90595 invoked by uid 500); 5 May 2014 15:59:23 -0000 Delivered-To: apmail-hadoop-common-commits-archive@hadoop.apache.org Received: (qmail 90503 invoked by uid 500); 5 May 2014 15:59:22 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-dev@hadoop.apache.org Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 90494 invoked by uid 99); 5 May 2014 15:59:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2014 15:59:22 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2014 15:59:20 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 898C92388980; Mon, 5 May 2014 15:59:00 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1592561 - in /hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common: CHANGES-HDFS-2006.txt src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java src/test/java/org/apache/hadoop/fs/shell/TestXAttrCommands.java Date: Mon, 05 May 2014 15:59:00 -0000 To: common-commits@hadoop.apache.org From: umamahesh@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140505155900.898C92388980@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: umamahesh Date: Mon May 5 15:59:00 2014 New Revision: 1592561 URL: http://svn.apache.org/r1592561 Log: HADOOP-10575. Small fixes for XAttrCommands and test. Contributed by Yi Liu. Modified: hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/CHANGES-HDFS-2006.txt hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestXAttrCommands.java Modified: hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/CHANGES-HDFS-2006.txt URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/CHANGES-HDFS-2006.txt?rev=1592561&r1=1592560&r2=1592561&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/CHANGES-HDFS-2006.txt (original) +++ hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/CHANGES-HDFS-2006.txt Mon May 5 15:59:00 2014 @@ -8,18 +8,20 @@ HDFS-2006 (Unreleased) IMPROVEMENTS - HADOOP-10520. Extended attributes definition and FileSystem APIs for - extended attributes. (Yi Liu via wang) + HADOOP-10520. Extended attributes definition and FileSystem APIs for + extended attributes. (Yi Liu via wang) - HADOOP-10546. Javadoc and other small fixes for extended attributes in - hadoop-common. (Charles Lamb via wang) + HADOOP-10546. Javadoc and other small fixes for extended attributes in + hadoop-common. (Charles Lamb via wang) - HADOOP-10521. FsShell commands for extended attributes. (Yi Liu via wang) + HADOOP-10521. FsShell commands for extended attributes. (Yi Liu via wang) - HADOOP-10548. Improve FsShell xattr error handling and other fixes. (Charles Lamb via umamahesh) + HADOOP-10548. Improve FsShell xattr error handling and other fixes. (Charles Lamb via umamahesh) - HADOOP-10567. Shift XAttr value encoding code out for reuse. (Yi Liu via umamahesh) + HADOOP-10567. Shift XAttr value encoding code out for reuse. (Yi Liu via umamahesh) OPTIMIZATIONS BUG FIXES + + HADOOP-10575. Small fixes for XAttrCommands and test. (Yi Liu via umamahesh) Modified: hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java?rev=1592561&r1=1592560&r2=1592561&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java (original) +++ hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/shell/XAttrCommands.java Mon May 5 15:59:00 2014 @@ -118,10 +118,12 @@ class XAttrCommands extends FsCommand { } private void printXAttr(String name, byte[] value) throws IOException{ - if (value != null && value.length != 0) { - out.println(name + "=" + XAttrCodec.encodeValue(value, encoding)); - } else { - out.println(name); + if (value != null) { + if (value.length != 0) { + out.println(name + "=" + XAttrCodec.encodeValue(value, encoding)); + } else { + out.println(name); + } } } } Modified: hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestXAttrCommands.java URL: http://svn.apache.org/viewvc/hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestXAttrCommands.java?rev=1592561&r1=1592560&r2=1592561&view=diff ============================================================================== --- hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestXAttrCommands.java (original) +++ hadoop/common/branches/HDFS-2006/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/shell/TestXAttrCommands.java Mon May 5 15:59:00 2014 @@ -27,6 +27,7 @@ import java.io.PrintStream; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FsShell; import org.apache.hadoop.util.ToolRunner; +import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -34,12 +35,21 @@ public class TestXAttrCommands { private final ByteArrayOutputStream errContent = new ByteArrayOutputStream(); private Configuration conf = null; + private PrintStream initialStdErr; @Before public void setup() throws IOException { + errContent.reset(); + initialStdErr = System.err; System.setErr(new PrintStream(errContent)); conf = new Configuration(); } + + @After + public void cleanUp() throws Exception { + errContent.reset(); + System.setErr(initialStdErr); + } @Test public void testGetfattrValidations() throws Exception {