Return-Path: Delivered-To: apmail-hadoop-core-commits-archive@www.apache.org Received: (qmail 23097 invoked from network); 30 Jan 2008 06:56:07 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Jan 2008 06:56:07 -0000 Received: (qmail 76510 invoked by uid 500); 30 Jan 2008 06:55:58 -0000 Delivered-To: apmail-hadoop-core-commits-archive@hadoop.apache.org Received: (qmail 76479 invoked by uid 500); 30 Jan 2008 06:55:58 -0000 Mailing-List: contact core-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: core-dev@hadoop.apache.org Delivered-To: mailing list core-commits@hadoop.apache.org Received: (qmail 76470 invoked by uid 99); 30 Jan 2008 06:55:58 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 29 Jan 2008 22:55:58 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 30 Jan 2008 06:55:39 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 73F5B1A9832; Tue, 29 Jan 2008 22:55:46 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r616660 - in /hadoop/core/trunk: CHANGES.txt src/java/org/apache/hadoop/fs/FileSystem.java src/test/org/apache/hadoop/fs/TestGlobPaths.java Date: Wed, 30 Jan 2008 06:55:45 -0000 To: core-commits@hadoop.apache.org From: nigel@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080130065546.73F5B1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: nigel Date: Tue Jan 29 22:55:44 2008 New Revision: 616660 URL: http://svn.apache.org/viewvc?rev=616660&view=rev Log: HADOOP-2732. Fix bug in path globbing. Contributed by Hairong Kuang. Modified: hadoop/core/trunk/CHANGES.txt hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java Modified: hadoop/core/trunk/CHANGES.txt URL: http://svn.apache.org/viewvc/hadoop/core/trunk/CHANGES.txt?rev=616660&r1=616659&r2=616660&view=diff ============================================================================== --- hadoop/core/trunk/CHANGES.txt (original) +++ hadoop/core/trunk/CHANGES.txt Tue Jan 29 22:55:44 2008 @@ -611,6 +611,8 @@ HADOOP-2641. Added Apache license headers to 95 files. (nigel) + HADOOP-2732. Fix bug in path globbing. (Hairong Kuang via nigel) + Release 0.15.3 - 2008-01-18 BUG FIXES Modified: hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java?rev=616660&r1=616659&r2=616660&view=diff ============================================================================== --- hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java (original) +++ hadoop/core/trunk/src/java/org/apache/hadoop/fs/FileSystem.java Tue Jan 29 22:55:44 2008 @@ -888,7 +888,6 @@ int setOpen; int curlyOpen; boolean setRange; - boolean expectGroup; StringBuilder fileRegex = new StringBuilder(); @@ -900,7 +899,6 @@ setOpen = 0; setRange = false; curlyOpen = 0; - expectGroup = false; for (int i = 0; i < len; i++) { char pCh; @@ -929,11 +927,8 @@ } else if (pCh == ',' && curlyOpen > 0) { fileRegex.append(")|"); pCh = '('; - expectGroup = true; } else if (pCh == '}' && curlyOpen > 0) { // End of a group - if (expectGroup) - error("Unexpected end of a group", filePattern, i); curlyOpen--; fileRegex.append(")"); pCh = ')'; @@ -956,8 +951,6 @@ // Normal character, or the end of a character set range setOpen++; setRange = false; - } else if (curlyOpen > 0) { - expectGroup = false; } fileRegex.append(pCh); } Modified: hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java URL: http://svn.apache.org/viewvc/hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java?rev=616660&r1=616659&r2=616660&view=diff ============================================================================== --- hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java (original) +++ hadoop/core/trunk/src/test/org/apache/hadoop/fs/TestGlobPaths.java Tue Jan 29 22:55:44 2008 @@ -268,7 +268,7 @@ } try { // test standalone } - files = new String[] {USER_DIR+"/}bc"}; + files = new String[] {USER_DIR+"/}bc", USER_DIR+"/}c"}; matchedPath = prepareTesting(USER_DIR+"/}{a,b}c", files); assertEquals(matchedPath.length, 1); assertEquals(matchedPath[0], path[0]); @@ -281,16 +281,30 @@ assertEquals(matchedPath.length, 1); assertEquals(matchedPath[0], path[0]); + // test {,} + matchedPath = prepareTesting(USER_DIR+"/}{,}bc", files); + assertEquals(matchedPath.length, 1); + assertEquals(matchedPath[0], path[0]); + + // test {b,} + matchedPath = prepareTesting(USER_DIR+"/}{b,}c", files); + assertEquals(matchedPath.length, 2); + assertEquals(matchedPath[0], path[0]); + assertEquals(matchedPath[1], path[1]); + + // test {,b} + matchedPath = prepareTesting(USER_DIR+"/}{,b}c", files); + assertEquals(matchedPath.length, 2); + assertEquals(matchedPath[0], path[0]); + assertEquals(matchedPath[1], path[1]); + + // test a combination of {} and ? + matchedPath = prepareTesting(USER_DIR+"/}{ac,?}", files); + assertEquals(matchedPath.length, 1); + assertEquals(matchedPath[0], path[1]); + // test ill-formed curly boolean hasException = false; - try { - prepareTesting(USER_DIR+"}{b,}c", files); - } catch (IOException e) { - assertTrue(e.getMessage().startsWith("Illegal file pattern:") ); - hasException = true; - } - assertTrue(hasException); - hasException = false; try { prepareTesting(USER_DIR+"}{bc", files); } catch (IOException e) {