This is an automated email from the ASF dual-hosted git repository. stevel pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/trunk by this push: new 5840df8 HADOOP-16479. ABFS FileStatus.getModificationTime returns localized time instead of UTC. 5840df8 is described below commit 5840df86d7a9e79007745688313f1d799d89189b Author: bilaharith <th.bilah...@gmail.com> AuthorDate: Thu Aug 8 19:08:04 2019 +0100 HADOOP-16479. ABFS FileStatus.getModificationTime returns localized time instead of UTC. Contributed by Bilahari T H Change-Id: I532055baaadfd7c324710e4b25f60cdf0378bdc0 --- .../hadoop/fs/azurebfs/AzureBlobFileSystemStore.java | 2 +- .../azurebfs/ITestAzureBlobFileSystemFileStatus.java | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java index 2402dbc..138339c 100644 --- a/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java +++ b/hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/AzureBlobFileSystemStore.java @@ -118,7 +118,7 @@ public class AzureBlobFileSystemStore implements Closeable { private URI uri; private String userName; private String primaryUserGroup; - private static final String DATE_TIME_PATTERN = "E, dd MMM yyyy HH:mm:ss 'GMT'"; + private static final String DATE_TIME_PATTERN = "E, dd MMM yyyy HH:mm:ss z"; private static final String TOKEN_DATE_PATTERN = "yyyy-MM-dd'T'HH:mm:ss.SSSSSSS'Z'"; private static final String XMS_PROPERTIES_ENCODING = "ISO-8859-1"; private static final int LIST_MAX_RESULTS = 500; diff --git a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java index f514696..421fa9a 100644 --- a/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java +++ b/hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/ITestAzureBlobFileSystemFileStatus.java @@ -122,4 +122,22 @@ public class ITestAzureBlobFileSystemFileStatus extends assertEquals(pathWithHost2.getName(), fileStatus2.getPath().getName()); } + @Test + public void testLastModifiedTime() throws IOException { + AzureBlobFileSystem fs = this.getFileSystem(); + Path testFilePath = new Path("childfile1.txt"); + long createStartTime = System.currentTimeMillis(); + long minCreateStartTime = (createStartTime / 1000) * 1000 - 1; + // Dividing and multiplying by 1000 to make last 3 digits 0. + // It is observed that modification time is returned with last 3 + // digits 0 always. + fs.create(testFilePath); + long createEndTime = System.currentTimeMillis(); + FileStatus fStat = fs.getFileStatus(testFilePath); + long lastModifiedTime = fStat.getModificationTime(); + assertTrue("lastModifiedTime should be after minCreateStartTime", + minCreateStartTime < lastModifiedTime); + assertTrue("lastModifiedTime should be before createEndTime", + createEndTime > lastModifiedTime); + } } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org