Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id D7BC9200C8E for ; Thu, 8 Jun 2017 22:05:58 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id D6565160BE8; Thu, 8 Jun 2017 20:05:58 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 2C929160BE7 for ; Thu, 8 Jun 2017 22:05:58 +0200 (CEST) Received: (qmail 34588 invoked by uid 500); 8 Jun 2017 20:05:47 -0000 Mailing-List: contact common-commits-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list common-commits@hadoop.apache.org Received: (qmail 34057 invoked by uid 99); 8 Jun 2017 20:05:47 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 08 Jun 2017 20:05:47 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 68119F4A43; Thu, 8 Jun 2017 20:05:44 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: xyao@apache.org To: common-commits@hadoop.apache.org Date: Thu, 08 Jun 2017 20:06:19 -0000 Message-Id: <193ee4ed5a5042a1bac03cb3f67f7115@git.apache.org> In-Reply-To: <351cfc1b40944c8ab1ec09a97f5f7fec@git.apache.org> References: <351cfc1b40944c8ab1ec09a97f5f7fec@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [37/50] [abbrv] hadoop git commit: HADOOP-14431. ModifyTime of FileStatus returned by SFTPFileSystem's getFileStatus method is wrong. Contributed by Hongyuan Li. archived-at: Thu, 08 Jun 2017 20:05:58 -0000 HADOOP-14431. ModifyTime of FileStatus returned by SFTPFileSystem's getFileStatus method is wrong. Contributed by Hongyuan Li. Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/4c06897a Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/4c06897a Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/4c06897a Branch: refs/heads/HDFS-7240 Commit: 4c06897a3637e60e481b6537e21c6d0d13415d6a Parents: 23b15b2 Author: Brahma Reddy Battula Authored: Tue Jun 6 12:31:40 2017 +0800 Committer: Xiaoyu Yao Committed: Thu Jun 8 10:44:51 2017 -0700 ---------------------------------------------------------------------- .../main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java | 2 +- .../java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c06897a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java index d91d391..6de69fa 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/sftp/SFTPFileSystem.java @@ -277,7 +277,7 @@ public class SFTPFileSystem extends FileSystem { // Using default block size since there is no way in SFTP channel to know of // block sizes on server. The assumption could be less than ideal. long blockSize = DEFAULT_BLOCK_SIZE; - long modTime = attr.getMTime() * 1000; // convert to milliseconds + long modTime = attr.getMTime() * 1000L; // convert to milliseconds long accessTime = attr.getATime() * 1000L; FsPermission permission = getPermissions(sftpFile); // not be able to get the real user group name, just use the user and group http://git-wip-us.apache.org/repos/asf/hadoop/blob/4c06897a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java ---------------------------------------------------------------------- diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java index 9b514e1..3d57dab 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java @@ -319,4 +319,13 @@ public class TestSFTPFileSystem { assertEquals(accessTime1, accessTime2); } + @Test + public void testGetModifyTime() throws IOException { + Path file = touch(localFs, name.getMethodName().toLowerCase() + "1"); + java.io.File localFile = ((LocalFileSystem) localFs).pathToFile(file); + long modifyTime1 = localFile.lastModified(); + long modifyTime2 = sftpFs.getFileStatus(file).getModificationTime(); + assertEquals(modifyTime1, modifyTime2); + } + } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org For additional commands, e-mail: common-commits-help@hadoop.apache.org