From 2d2ec00ca3c7d4f5d5706153b3eab162262fddfc Mon Sep 17 00:00:00 2001 From: Uma Maheswara Rao G Date: Fri, 19 Jun 2020 10:55:31 -0700 Subject: [PATCH] Fixed a checkstyle and few review comments --- .../org/apache/hadoop/fs/viewfs/ViewFileSystem.java | 10 +++++----- .../main/java/org/apache/hadoop/fs/viewfs/ViewFs.java | 9 ++++----- .../fs/viewfs/TestViewFsOverloadSchemeListStatus.java | 10 ++++++---- .../apache/hadoop/fs/viewfs/TestViewfsFileStatus.java | 4 ++-- 4 files changed, 17 insertions(+), 16 deletions(-) diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java index 8ccc09ff0b4..3f682abb1b5 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFileSystem.java @@ -1116,7 +1116,7 @@ public class ViewFileSystem extends FileSystem { final long creationTime; // of the the mount table final UserGroupInformation ugi; // the user/group of user who created mtable final URI myUri; - final boolean showMountLinksAsSymlinks; + private final boolean showMountLinksAsSymlinks; public InternalDirOfViewFs(final InodeTree.INodeDir dir, final long cTime, final UserGroupInformation ugi, URI uri, @@ -1262,10 +1262,10 @@ public class ViewFileSystem extends FileSystem { throw ex; } } else { - result[i++] = new FileStatus(0, true, 0, 0, - creationTime, creationTime, PERMISSION_555, - ugi.getShortUserName(), ugi.getPrimaryGroupName(), - path); + result[i++] = + new FileStatus(0, true, 0, 0, creationTime, creationTime, + PERMISSION_555, ugi.getShortUserName(), + ugi.getPrimaryGroupName(), path); } } if (fallbackStatuses.length > 0) { diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java index fbbbe37c000..a95df56bdb1 100644 --- a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java +++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/viewfs/ViewFs.java @@ -1056,11 +1056,10 @@ public class ViewFs extends AbstractFileSystem { throw ex; } } else { - result[i++] = new FileStatus(0, true, 0, 0, - creationTime, creationTime, - PERMISSION_555, ugi.getShortUserName(), ugi.getGroupNames()[0], - new Path(inode.fullPath).makeQualified( - myUri, null)); + result[i++] = + new FileStatus(0, true, 0, 0, creationTime, creationTime, + PERMISSION_555, ugi.getShortUserName(), + ugi.getGroupNames()[0], path); } } if (fallbackStatuses.length > 0) { diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsOverloadSchemeListStatus.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsOverloadSchemeListStatus.java index 519f0687b15..0cf691481f7 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsOverloadSchemeListStatus.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewFsOverloadSchemeListStatus.java @@ -47,12 +47,14 @@ public class TestViewFsOverloadSchemeListStatus { private static final File TEST_DIR = GenericTestUtils.getTestDir(TestViewfsFileStatus.class.getSimpleName()); - @Before public void setUp() { + @Before + public void setUp() { FileUtil.fullyDelete(TEST_DIR); assertTrue(TEST_DIR.mkdirs()); } - @After public void tearDown() throws IOException { + @After + public void tearDown() throws IOException { FileUtil.fullyDelete(TEST_DIR); } @@ -112,11 +114,11 @@ public class TestViewFsOverloadSchemeListStatus { if (status.getPath().getName().equals(fileScheme)) { assertEquals(FsPermission.valueOf("-rwxr--r--"), status.getPermission()); - assertEquals(false, status.isDirectory()); + assertFalse(status.isDirectory()); } else { assertEquals(FsPermission.valueOf("-r--rwxr--"), status.getPermission()); - assertEquals(true, status.isDirectory()); + assertTrue(status.isDirectory()); } } } diff --git a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewfsFileStatus.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewfsFileStatus.java index 1831fb6e164..75557456edc 100644 --- a/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewfsFileStatus.java +++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/viewfs/TestViewfsFileStatus.java @@ -148,11 +148,11 @@ public class TestViewfsFileStatus { if (status.getPath().getName().equals("file")) { assertEquals(FsPermission.valueOf("-rwxr--r--"), status.getPermission()); - assertEquals(false, status.isDirectory()); + assertFalse(status.isDirectory()); } else { assertEquals(FsPermission.valueOf("-r--rwxr--"), status.getPermission()); - assertEquals(true, status.isDirectory()); + assertTrue(status.isDirectory()); } } }