hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bra...@apache.org
Subject [2/2] hadoop git commit: HADOOP-14431. ModifyTime of FileStatus returned by SFTPFileSystem's getFileStatus method is wrong. Contributed by Hongyuan Li.
Date Tue, 06 Jun 2017 04:32:51 GMT
HADOOP-14431. ModifyTime of FileStatus returned by SFTPFileSystem's getFileStatus method is
wrong. Contributed by Hongyuan Li.

(cherry picked from commit 66c6fd831497944f4f49c5ce42c69a302b7d7bc0)


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/e889c826
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/e889c826
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/e889c826

Branch: refs/heads/branch-2
Commit: e889c826d7670345ce82cc2db3430a67a4095f68
Parents: 95c2978
Author: Brahma Reddy Battula <brahma@apache.org>
Authored: Tue Jun 6 12:31:40 2017 +0800
Committer: Brahma Reddy Battula <brahma@apache.org>
Committed: Tue Jun 6 12:32:37 2017 +0800

----------------------------------------------------------------------
 .../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/e889c826/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 e4e7bbf..e181ced 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
@@ -278,7 +278,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/e889c826/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 ad54dc0..ae13006 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
@@ -320,4 +320,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


Mime
View raw message