[ https://issues.apache.org/jira/browse/HADOOP-14486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16038433#comment-16038433 ]
Hongyuan Li edited comment on HADOOP-14486 at 6/6/17 9:26 AM: -------------------------------------------------------------- [~Sonia] i checked this issue with the same environment and found out that the oracle jdk and openjdk's implements of code below is different. {code} Files.readAttributes(path, BasicFileAttributes.class) {code} That does not relate to the os system except the windows os. Futhermore, openjdk 1.7 acts the same as oracle jdk. So, two suggestions to solve this : 1、use oracle jdk 1.8 2、if you want to use openjdk 1.8, you can modify the TestSFTPFileSystem#testGetAccessTime code like code below: {code} @Test public void testGetAccessTime() throws IOException { Path file = touch(localFs, name.getMethodName().toLowerCase()); LocalFileSystem local = (LocalFileSystem)localFs; java.nio.file.Path path = (local).pathToFile(file).toPath(); long accessTime1 = Files.readAttributes(path, BasicFileAttributes.class) .lastAccessTime().toMillis(); accessTime1 = accessTime1 / 1000 * 1000; long accessTime2 = sftpFs.getFileStatus(file).getAccessTime(); assertEquals(accessTime1, accessTime2); } {code} [~ste...@apache.org],Any good idea to solve this ? was (Author: hongyuan li): [~Sonia] i checked this issue with the same environment and found out that the oracle jdk and openjdk's implements of code below is different. {code} Files.readAttributes(path, BasicFileAttributes.class) {code} That does not relate to the os system except the windows os. Futhermore, openjdk 1.7 acts the same as oracle jdk. So, two suggestions to solve this : 1、use oracle jdk 1.8 2、if you want to use openjdk 1.8, you can modify the TestSFTPFileSystem#testGetAccessTime code like code below: {code} @Test public void testGetAccessTime() throws IOException { Path file = touch(localFs, name.getMethodName().toLowerCase()); LocalFileSystem local = (LocalFileSystem)localFs; java.nio.file.Path path = (local).pathToFile(file).toPath(); long accessTime1 = Files.readAttributes(path, BasicFileAttributes.class) .lastAccessTime().toMillis(); accessTime1 = accessTime1 / 1000 * 1000; long accessTime2 = sftpFs.getFileStatus(file).getAccessTime(); assertEquals(accessTime1, accessTime2); } {code} [~ste...@apache.org], can this issue be closed or fixed ? > TestSFTPFileSystem#testGetAccessTime test failure > ------------------------------------------------- > > Key: HADOOP-14486 > URL: https://issues.apache.org/jira/browse/HADOOP-14486 > Project: Hadoop Common > Issue Type: Bug > Affects Versions: 3.0.0-alpha4 > Environment: Ubuntu 14.04 > x86, ppc64le > $ java -version > openjdk version "1.8.0_111" > OpenJDK Runtime Environment (build 1.8.0_111-8u111-b14-3~14.04.1-b14) > OpenJDK 64-Bit Server VM (build 25.111-b14, mixed mode) > Reporter: Sonia Garudi > Assignee: Hongyuan Li > > The TestSFTPFileSystem#testGetAccessTime test fails consistently with the > error below: > {code} > java.lang.AssertionError: expected:<1496496040072> but was:<1496496040000> > at org.junit.Assert.fail(Assert.java:88) > at org.junit.Assert.failNotEquals(Assert.java:743) > at org.junit.Assert.assertEquals(Assert.java:118) > at org.junit.Assert.assertEquals(Assert.java:555) > at org.junit.Assert.assertEquals(Assert.java:542) > at > org.apache.hadoop.fs.sftp.TestSFTPFileSystem.testGetAccessTime(TestSFTPFileSystem.java:319) > {code} -- This message was sent by Atlassian JIRA (v6.3.15#6346) --------------------------------------------------------------------- To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-issues-h...@hadoop.apache.org