Przeglądaj źródła

HADOOP-14485. Redundant 'final' modifier in try-with-resources statement. Contributed by wenxin he.

Brahma Reddy Battula 8 lat temu
rodzic
commit
19ef3a81f8

+ 4 - 4
hadoop-client-modules/hadoop-client-integration-tests/src/test/java/org/apache/hadoop/example/ITUseMiniCluster.java

@@ -82,7 +82,7 @@ public class ITUseMiniCluster {
 
   @Test
   public void useHdfsFileSystem() throws IOException {
-    try (final FileSystem fs = cluster.getFileSystem()) {
+    try (FileSystem fs = cluster.getFileSystem()) {
       simpleReadAfterWrite(fs);
     }
   }
@@ -94,10 +94,10 @@ public class ITUseMiniCluster {
       throw new IOException("Mkdirs failed to create " +
           TEST_PATH);
     }
-    try (final FSDataOutputStream out = fs.create(path)) {
+    try (FSDataOutputStream out = fs.create(path)) {
       out.writeUTF(TEXT);
     }
-    try (final FSDataInputStream in = fs.open(path)) {
+    try (FSDataInputStream in = fs.open(path)) {
       final String result = in.readUTF();
       Assert.assertEquals("Didn't read back text we wrote.", TEXT, result);
     }
@@ -105,7 +105,7 @@ public class ITUseMiniCluster {
 
   @Test
   public void useWebHDFS() throws IOException, URISyntaxException {
-    try (final FileSystem fs = WebHdfsTestUtil.getWebHdfsFileSystem(
+    try (FileSystem fs = WebHdfsTestUtil.getWebHdfsFileSystem(
         cluster.getConfiguration(0), WebHdfsConstants.WEBHDFS_SCHEME)) {
       simpleReadAfterWrite(fs);
     }

+ 1 - 1
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java

@@ -1425,7 +1425,7 @@ public class TestIPC {
   }
 
   private void checkVersionMismatch() throws IOException {
-    try (final ServerSocket listenSocket = new ServerSocket()) {
+    try (ServerSocket listenSocket = new ServerSocket()) {
       listenSocket.bind(null);
       InetSocketAddress addr =
           (InetSocketAddress) listenSocket.getLocalSocketAddress();

+ 1 - 1
hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/lib/TestRollingAverages.java

@@ -42,7 +42,7 @@ public class TestRollingAverages {
   public void testRollingAveragesEmptyRollover() throws Exception {
     final MetricsRecordBuilder rb = mockMetricsRecordBuilder();
     /* 5s interval and 2 windows */
-    try (final RollingAverages rollingAverages =
+    try (RollingAverages rollingAverages =
              new RollingAverages(5000, 2)) {
       /* Check it initially */
       rollingAverages.snapshot(rb, true);

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java

@@ -254,7 +254,7 @@ public class TestMiniDFSCluster {
   @Test
   public void testClusterNoStorageTypeSetForDatanodes() throws IOException {
     final Configuration conf = new HdfsConfiguration();
-    try (final MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
+    try (MiniDFSCluster cluster = new MiniDFSCluster.Builder(conf)
         .numDataNodes(3).build()) {
       cluster.waitActive();
       ArrayList<DataNode> dataNodes = cluster.getDataNodes();

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java

@@ -1847,7 +1847,7 @@ public class TestBalancer {
     for(int i = 0; i < lengths.length; i++) {
       final long size = lengths[i];
       final Path p = new Path("/file" + i + "_size" + size);
-      try(final OutputStream out = dfs.create(p)) {
+      try(OutputStream out = dfs.create(p)) {
         for(int j = 0; j < size; j++) {
           out.write(j);
         }

+ 1 - 1
hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeFaultInjector.java

@@ -153,7 +153,7 @@ public class TestDataNodeFaultInjector {
       cluster.waitActive();
 
       final FileSystem fs = cluster.getFileSystem();
-      try (final FSDataOutputStream out = fs
+      try (FSDataOutputStream out = fs
           .create(new Path(baseDir, "test.data"), (short) 2)) {
         out.write(0x31);
         out.hflush();

+ 1 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java

@@ -303,7 +303,7 @@ public class TestYarnClient {
     int pollIntervalMs = 1000;
     conf.setLong(YarnConfiguration.YARN_CLIENT_APP_SUBMISSION_POLL_INTERVAL_MS,
         pollIntervalMs);
-    try (final YarnClient client = new MockYarnClient()) {
+    try (YarnClient client = new MockYarnClient()) {
       client.init(conf);
       client.start();
       // Submit the application and then interrupt it while its waiting