Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6453518C7E for ; Wed, 4 Nov 2015 01:13:28 +0000 (UTC) Received: (qmail 32736 invoked by uid 500); 4 Nov 2015 01:13:28 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 32630 invoked by uid 500); 4 Nov 2015 01:13:28 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 32389 invoked by uid 99); 4 Nov 2015 01:13:28 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 Nov 2015 01:13:28 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id CD4AB2C1F6C for ; Wed, 4 Nov 2015 01:13:27 +0000 (UTC) Date: Wed, 4 Nov 2015 01:13:27 +0000 (UTC) From: "Kazuho Fujii (JIRA)" To: common-issues@hadoop.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HADOOP-12543) Path#isRoot() returns true if the path is ".". MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-12543?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14988648#comment-14988648 ] Kazuho Fujii commented on HADOOP-12543: --------------------------------------- Hi, thanks for the comment. {{new Path(new Path("/tmp"), new Path(".."))}} equals {{new Path("/")}}. {{new Path("/").isRoot()}} equals true. This is OK. The behavior for relative path is misreading. {{new Path("..").getParent()}} equals {{new Path(".")}}. {{new Path(".").isRoot()}} always return true in the current implementation. A Path class object doesn't know the working directory. It can not say whether it repesents the root directory for relative path. Just seeing the method name and the comment, I misunderstood it returns true iif the path is "/". > Path#isRoot() returns true if the path is ".". > ---------------------------------------------- > > Key: HADOOP-12543 > URL: https://issues.apache.org/jira/browse/HADOOP-12543 > Project: Hadoop Common > Issue Type: Bug > Components: fs > Reporter: Kazuho Fujii > Attachments: HADOOP-12543.001.patch > > > {{Path#isRoot()}} method is expected to return true if and only if the path represents the root of a file system. But, it returns true in the case where the path is ".". This is because {{getParent()}} method returns null when the path in URI is empty. -- This message was sent by Atlassian JIRA (v6.3.4#6332)