Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-14485

Redundant 'final' modifier in try-with-resources statement

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.0.0-alpha4
    • Fix Version/s: 3.0.0-alpha4
    • Component/s: None
    • Labels:
    • Hadoop Flags:
      Reviewed

      Description

      Redundant 'final' modifier in the try-with-resources statement. Any variable declared in the try-with-resources statement is implicitly modified with final.

        Activity

        Hide
        vincent he Wenxin He added a comment -

        any reassign will cause compilation error, so remove the redundant 'final' modifier in the patch.

        try (YarnClient client = new MockYarnClient()) {
              client.init(conf);
              client.start();
              client = null;
        
        [INFO] -------------------------------------------------------------
        [ERROR] COMPILATION ERROR : 
        [INFO] -------------------------------------------------------------
        [ERROR] /home/vincent/Codebase/apache/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java:[309,7] auto-closeable resource client may not be assigned
        
        Show
        vincent he Wenxin He added a comment - any reassign will cause compilation error, so remove the redundant 'final' modifier in the patch. try (YarnClient client = new MockYarnClient()) { client.init(conf); client.start(); client = null ; [INFO] ------------------------------------------------------------- [ERROR] COMPILATION ERROR : [INFO] ------------------------------------------------------------- [ERROR] /home/vincent/Codebase/apache/hadoop/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java:[309,7] auto-closeable resource client may not be assigned
        Hide
        hadoopqa Hadoop QA added a comment -
        -1 overall



        Vote Subsystem Runtime Comment
        0 reexec 0m 20s Docker mode activated.
        +1 @author 0m 0s The patch does not contain any @author tags.
        +1 test4tests 0m 0s The patch appears to include 7 new or modified test files.
        0 mvndep 1m 25s Maven dependency ordering for branch
        +1 mvninstall 13m 20s trunk passed
        +1 compile 13m 19s trunk passed
        +1 checkstyle 1m 59s trunk passed
        +1 mvnsite 2m 52s trunk passed
        +1 mvneclipse 1m 24s trunk passed
        0 findbugs 0m 0s Skipped patched modules with no Java source: hadoop-client-modules/hadoop-client-integration-tests
        -1 findbugs 1m 23s hadoop-common-project/hadoop-common in trunk has 19 extant Findbugs warnings.
        +1 javadoc 2m 20s trunk passed
        0 mvndep 0m 17s Maven dependency ordering for patch
        +1 mvninstall 2m 3s the patch passed
        +1 compile 12m 35s the patch passed
        +1 javac 12m 35s the patch passed
        +1 checkstyle 2m 0s root: The patch generated 0 new + 343 unchanged - 10 fixed = 343 total (was 353)
        +1 mvnsite 2m 59s the patch passed
        +1 mvneclipse 1m 35s the patch passed
        +1 whitespace 0m 0s The patch has no whitespace issues.
        0 findbugs 0m 0s Skipped patched modules with no Java source: hadoop-client-modules/hadoop-client-integration-tests
        +1 findbugs 4m 23s the patch passed
        +1 javadoc 2m 32s the patch passed
        +1 unit 8m 0s hadoop-common in the patch passed.
        -1 unit 63m 46s hadoop-hdfs in the patch failed.
        +1 unit 19m 32s hadoop-yarn-client in the patch passed.
        +1 unit 0m 24s hadoop-client-integration-tests in the patch passed.
        +1 asflicense 0m 43s The patch does not generate ASF License warnings.
        186m 38s



        Reason Tests
        Failed junit tests hadoop.hdfs.TestDFSStripedOutputStreamWithFailure090
          hadoop.hdfs.server.namenode.ha.TestPipelinesFailover



        Subsystem Report/Notes
        Docker Image:yetus/hadoop:14b5c93
        JIRA Issue HADOOP-14485
        JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12871119/HADOOP-14485.001.patch
        Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle
        uname Linux 43b8fd8f2877 3.13.0-116-generic #163-Ubuntu SMP Fri Mar 31 14:13:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
        Build tool maven
        Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh
        git revision trunk / 367da9b
        Default Java 1.8.0_131
        findbugs v3.1.0-RC1
        findbugs https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/artifact/patchprocess/branch-findbugs-hadoop-common-project_hadoop-common-warnings.html
        unit https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/testReport/
        modules C: hadoop-common-project/hadoop-common hadoop-hdfs-project/hadoop-hdfs hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client hadoop-client-modules/hadoop-client-integration-tests U: .
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/console
        Powered by Apache Yetus 0.5.0-SNAPSHOT http://yetus.apache.org

        This message was automatically generated.

        Show
        hadoopqa Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 reexec 0m 20s Docker mode activated. +1 @author 0m 0s The patch does not contain any @author tags. +1 test4tests 0m 0s The patch appears to include 7 new or modified test files. 0 mvndep 1m 25s Maven dependency ordering for branch +1 mvninstall 13m 20s trunk passed +1 compile 13m 19s trunk passed +1 checkstyle 1m 59s trunk passed +1 mvnsite 2m 52s trunk passed +1 mvneclipse 1m 24s trunk passed 0 findbugs 0m 0s Skipped patched modules with no Java source: hadoop-client-modules/hadoop-client-integration-tests -1 findbugs 1m 23s hadoop-common-project/hadoop-common in trunk has 19 extant Findbugs warnings. +1 javadoc 2m 20s trunk passed 0 mvndep 0m 17s Maven dependency ordering for patch +1 mvninstall 2m 3s the patch passed +1 compile 12m 35s the patch passed +1 javac 12m 35s the patch passed +1 checkstyle 2m 0s root: The patch generated 0 new + 343 unchanged - 10 fixed = 343 total (was 353) +1 mvnsite 2m 59s the patch passed +1 mvneclipse 1m 35s the patch passed +1 whitespace 0m 0s The patch has no whitespace issues. 0 findbugs 0m 0s Skipped patched modules with no Java source: hadoop-client-modules/hadoop-client-integration-tests +1 findbugs 4m 23s the patch passed +1 javadoc 2m 32s the patch passed +1 unit 8m 0s hadoop-common in the patch passed. -1 unit 63m 46s hadoop-hdfs in the patch failed. +1 unit 19m 32s hadoop-yarn-client in the patch passed. +1 unit 0m 24s hadoop-client-integration-tests in the patch passed. +1 asflicense 0m 43s The patch does not generate ASF License warnings. 186m 38s Reason Tests Failed junit tests hadoop.hdfs.TestDFSStripedOutputStreamWithFailure090   hadoop.hdfs.server.namenode.ha.TestPipelinesFailover Subsystem Report/Notes Docker Image:yetus/hadoop:14b5c93 JIRA Issue HADOOP-14485 JIRA Patch URL https://issues.apache.org/jira/secure/attachment/12871119/HADOOP-14485.001.patch Optional Tests asflicense compile javac javadoc mvninstall mvnsite unit findbugs checkstyle uname Linux 43b8fd8f2877 3.13.0-116-generic #163-Ubuntu SMP Fri Mar 31 14:13:22 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux Build tool maven Personality /testptch/hadoop/patchprocess/precommit/personality/provided.sh git revision trunk / 367da9b Default Java 1.8.0_131 findbugs v3.1.0-RC1 findbugs https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/artifact/patchprocess/branch-findbugs-hadoop-common-project_hadoop-common-warnings.html unit https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/artifact/patchprocess/patch-unit-hadoop-hdfs-project_hadoop-hdfs.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/testReport/ modules C: hadoop-common-project/hadoop-common hadoop-hdfs-project/hadoop-hdfs hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client hadoop-client-modules/hadoop-client-integration-tests U: . Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/12440/console Powered by Apache Yetus 0.5.0-SNAPSHOT http://yetus.apache.org This message was automatically generated.
        Hide
        vincent he Wenxin He added a comment -

        check the log, test failures and findbugs are unrelated.
        10 checkstyle issues fixed.

        Show
        vincent he Wenxin He added a comment - check the log, test failures and findbugs are unrelated. 10 checkstyle issues fixed.
        Hide
        vincent he Wenxin He added a comment -

        hi Akira Ajisaka and Brahma Reddy Battula, would you please review this patch?
        all 'final' modifier in try-with-resources statement are fixed by searching ' grep -r --include=*.java "try (" .' in hadoop.

        Show
        vincent he Wenxin He added a comment - hi Akira Ajisaka and Brahma Reddy Battula , would you please review this patch? all 'final' modifier in try-with-resources statement are fixed by searching ' grep -r --include=*.java "try (" .' in hadoop.
        Hide
        templedf Daniel Templeton added a comment -

        LGTM +1

        Show
        templedf Daniel Templeton added a comment - LGTM +1
        Hide
        vincent he Wenxin He added a comment -

        Thanks for your review Daniel Templeton. I appreciate it.
        Akira Ajisaka Brahma Reddy Battula Yiqun Lin what do you think? Thanks in advance.

        Show
        vincent he Wenxin He added a comment - Thanks for your review Daniel Templeton . I appreciate it. Akira Ajisaka Brahma Reddy Battula Yiqun Lin what do you think? Thanks in advance.
        Hide
        brahmareddy Brahma Reddy Battula added a comment -

        Hi Wenxin He

        Added you as hadoop contributor.Now onwards you can assign issues yourself.

        Please have look at following to know more about contribution.

        https://cwiki.apache.org/confluence/display/HADOOP/HowToContribute.

        thanks for reporting the issue.. Patch LGTM, will commit it later today if there are no further comments

        Show
        brahmareddy Brahma Reddy Battula added a comment - Hi Wenxin He Added you as hadoop contributor.Now onwards you can assign issues yourself. Please have look at following to know more about contribution. https://cwiki.apache.org/confluence/display/HADOOP/HowToContribute . thanks for reporting the issue.. Patch LGTM, will commit it later today if there are no further comments
        Hide
        vincent he Wenxin He added a comment -

        Thanks a lot, Brahma Reddy Battula.
        I've read 'HowToContribute', thanks!

        Show
        vincent he Wenxin He added a comment - Thanks a lot, Brahma Reddy Battula . I've read 'HowToContribute', thanks!
        Hide
        vincent he Wenxin He added a comment -

        Hi Brahma, can it be OK to commit?

        Show
        vincent he Wenxin He added a comment - Hi Brahma , can it be OK to commit?
        Hide
        brahmareddy Brahma Reddy Battula added a comment -

        will do it.

        Show
        brahmareddy Brahma Reddy Battula added a comment - will do it.
        Hide
        brahmareddy Brahma Reddy Battula added a comment -

        Committed to trunk.Wenxin He thanks for your contribution.Daniel Temme thanks for additional review.

        Show
        brahmareddy Brahma Reddy Battula added a comment - Committed to trunk. Wenxin He thanks for your contribution. Daniel Temme thanks for additional review.
        Hide
        hudson Hudson added a comment -

        SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #11830 (See https://builds.apache.org/job/Hadoop-trunk-Commit/11830/)
        HADOOP-14485. Redundant 'final' modifier in try-with-resources (brahma: rev 19ef3a81f8b90579b4a7a95839d0c3ebdd56349c)

        • (edit) hadoop-client-modules/hadoop-client-integration-tests/src/test/java/org/apache/hadoop/example/ITUseMiniCluster.java
        • (edit) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java
        • (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java
        • (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java
        • (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/lib/TestRollingAverages.java
        • (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java
        • (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeFaultInjector.java
        Show
        hudson Hudson added a comment - SUCCESS: Integrated in Jenkins build Hadoop-trunk-Commit #11830 (See https://builds.apache.org/job/Hadoop-trunk-Commit/11830/ ) HADOOP-14485 . Redundant 'final' modifier in try-with-resources (brahma: rev 19ef3a81f8b90579b4a7a95839d0c3ebdd56349c) (edit) hadoop-client-modules/hadoop-client-integration-tests/src/test/java/org/apache/hadoop/example/ITUseMiniCluster.java (edit) hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestYarnClient.java (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/ipc/TestIPC.java (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/TestMiniDFSCluster.java (edit) hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/metrics2/lib/TestRollingAverages.java (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/balancer/TestBalancer.java (edit) hadoop-hdfs-project/hadoop-hdfs/src/test/java/org/apache/hadoop/hdfs/server/datanode/TestDataNodeFaultInjector.java
        Hide
        vincent he Wenxin He added a comment -

        Thanks Brahma Reddy Battula and Daniel Templeton. I appreciate it.

        Show
        vincent he Wenxin He added a comment - Thanks Brahma Reddy Battula and Daniel Templeton . I appreciate it.

          People

          • Assignee:
            vincent he Wenxin He
            Reporter:
            vincent he Wenxin He
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development