You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by tm...@apache.org on 2019/08/27 21:35:00 UTC
[hadoop] 05/07: HADOOP-16479. ABFS FileStatus.getModificationTime
returns localized time instead of UTC.
This is an automated email from the ASF dual-hosted git repository.
tmarquardt pushed a commit to branch branch-3.2
in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit 3b3c0c4b8790ec4c96072a4704b320812296074b
Author: bilaharith <th...@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 06a819a..ce0d411 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
@@ -115,7 +115,7 @@ public class AzureBlobFileSystemStore {
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-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org