Hadoop Common
  1. Hadoop Common
  2. HADOOP-10364

JsonGenerator in Configuration#dumpConfiguration() is not closed

    Details

    • Type: Bug Bug
    • Status: Patch Available
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: conf
    • Labels:

      Description

          JsonGenerator dumpGenerator = dumpFactory.createJsonGenerator(out);
      

      dumpGenerator is not closed in Configuration#dumpConfiguration()

      Looking at the source code of org.codehaus.jackson.impl.WriterBasedGenerator#close(), there is more than flushing the buffer.

      1. HADOOP-10364.patch
        0.6 kB
        Sanghyun Yun
      2. HADOOP-10364.2.patch
        3 kB
        Sanghyun Yun

        Activity

        Hide
        Sanghyun Yun added a comment -

        I modify "flush()" at the end to "close()".
        close function will force flushing of output and close underlying output stream.

        Show
        Sanghyun Yun added a comment - I modify "flush()" at the end to "close()". close function will force flushing of output and close underlying output stream.
        Hide
        Tsuyoshi Ozawa added a comment -

        HI Sanghyun Yun, thanks for your contribution. To avoid a resource leak, we should add try {} finally {} block and close dumpGenerator in finally block.

        +    dumpGenerator.close();
        

        We should use IOUtils instead of using close() method directory, because close() can throw IOException and null check.

        Show
        Tsuyoshi Ozawa added a comment - HI Sanghyun Yun , thanks for your contribution. To avoid a resource leak, we should add try {} finally {} block and close dumpGenerator in finally block. + dumpGenerator.close(); We should use IOUtils instead of using close() method directory, because close() can throw IOException and null check.
        Hide
        Tsuyoshi Ozawa added a comment -

        s/directory/directly/

        Show
        Tsuyoshi Ozawa added a comment - s/directory/directly/
        Hide
        Sanghyun Yun added a comment -

        Tsuyoshi Ozawa Thanks for your review! I added try-finally block and modified code using IOUtils.cleanup() method.

        Show
        Sanghyun Yun added a comment - Tsuyoshi Ozawa Thanks for your review! I added try-finally block and modified code using IOUtils.cleanup() method.
        Hide
        Hadoop QA added a comment -

        -1 overall. Here are the results of testing the latest attachment
        http://issues.apache.org/jira/secure/attachment/12665692/HADOOP-10364.2.patch
        against trunk revision 258c7d0.

        +1 @author. The patch does not contain any @author tags.

        -1 tests included. The patch doesn't appear to include any new or modified tests.
        Please justify why no new tests are needed for this patch.
        Also please list what manual steps were performed to verify this patch.

        +1 javac. The applied patch does not increase the total number of javac compiler warnings.

        +1 javadoc. There were no new javadoc warning messages.

        +1 eclipse:eclipse. The patch built with eclipse:eclipse.

        +1 findbugs. The patch does not introduce any new Findbugs (version 2.0.3) warnings.

        +1 release audit. The applied patch does not increase the total number of release audit warnings.

        -1 core tests. The test build failed in hadoop-common-project/hadoop-common

        +1 contrib tests. The patch passed contrib unit tests.

        Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/4615//testReport/
        Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/4615//console

        This message is automatically generated.

        Show
        Hadoop QA added a comment - -1 overall . Here are the results of testing the latest attachment http://issues.apache.org/jira/secure/attachment/12665692/HADOOP-10364.2.patch against trunk revision 258c7d0. +1 @author . The patch does not contain any @author tags. -1 tests included . The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac . The applied patch does not increase the total number of javac compiler warnings. +1 javadoc . There were no new javadoc warning messages. +1 eclipse:eclipse . The patch built with eclipse:eclipse. +1 findbugs . The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 release audit . The applied patch does not increase the total number of release audit warnings. -1 core tests . The test build failed in hadoop-common-project/hadoop-common +1 contrib tests . The patch passed contrib unit tests. Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/4615//testReport/ Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/4615//console This message is automatically generated.
        Hide
        Tsuyoshi Ozawa added a comment -

        It looks good to me(non-binding).

        Show
        Tsuyoshi Ozawa added a comment - It looks good to me(non-binding).
        Hide
        Sanghyun Yun added a comment -

        Thank you, Tsuyoshi Ozawa.

        Show
        Sanghyun Yun added a comment - Thank you, Tsuyoshi Ozawa .
        Hide
        Hadoop QA added a comment -



        -1 overall



        Vote Subsystem Runtime Comment
        0 pre-patch 14m 39s Pre-patch trunk compilation is healthy.
        +1 @author 0m 0s The patch does not contain any @author tags.
        -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
        +1 javac 7m 30s There were no new javac warning messages.
        +1 javadoc 9m 36s There were no new javadoc warning messages.
        +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings.
        -1 checkstyle 1m 4s The applied patch generated 2 new checkstyle issues (total was 176, now 176).
        -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix.
        +1 install 1m 32s mvn install still works.
        +1 eclipse:eclipse 0m 33s The patch built with eclipse:eclipse.
        +1 findbugs 1m 38s The patch does not introduce any new Findbugs (version 2.0.3) warnings.
        +1 common tests 23m 9s Tests passed in hadoop-common.
            60m 8s  



        Subsystem Report/Notes
        Patch URL http://issues.apache.org/jira/secure/attachment/12665692/HADOOP-10364.2.patch
        Optional Tests javadoc javac unit findbugs checkstyle
        git revision trunk / 6ae2a0d
        checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/artifact/patchprocess/diffcheckstylehadoop-common.txt
        whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/artifact/patchprocess/whitespace.txt
        hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/artifact/patchprocess/testrun_hadoop-common.txt
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/testReport/
        Java 1.7.0_55
        uname Linux asf907.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/console

        This message was automatically generated.

        Show
        Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 pre-patch 14m 39s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac 7m 30s There were no new javac warning messages. +1 javadoc 9m 36s There were no new javadoc warning messages. +1 release audit 0m 23s The applied patch does not increase the total number of release audit warnings. -1 checkstyle 1m 4s The applied patch generated 2 new checkstyle issues (total was 176, now 176). -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix. +1 install 1m 32s mvn install still works. +1 eclipse:eclipse 0m 33s The patch built with eclipse:eclipse. +1 findbugs 1m 38s The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 common tests 23m 9s Tests passed in hadoop-common.     60m 8s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12665692/HADOOP-10364.2.patch Optional Tests javadoc javac unit findbugs checkstyle git revision trunk / 6ae2a0d checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/artifact/patchprocess/diffcheckstylehadoop-common.txt whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/artifact/patchprocess/whitespace.txt hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/artifact/patchprocess/testrun_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/testReport/ Java 1.7.0_55 uname Linux asf907.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/6442/console This message was automatically generated.
        Hide
        Hadoop QA added a comment -



        -1 overall



        Vote Subsystem Runtime Comment
        0 pre-patch 14m 27s Pre-patch trunk compilation is healthy.
        +1 @author 0m 0s The patch does not contain any @author tags.
        -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch.
        +1 javac 7m 28s There were no new javac warning messages.
        +1 javadoc 9m 36s There were no new javadoc warning messages.
        +1 release audit 0m 22s The applied patch does not increase the total number of release audit warnings.
        -1 checkstyle 1m 7s The applied patch generated 2 new checkstyle issues (total was 176, now 176).
        -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix.
        +1 install 1m 36s mvn install still works.
        +1 eclipse:eclipse 0m 32s The patch built with eclipse:eclipse.
        +1 findbugs 1m 40s The patch does not introduce any new Findbugs (version 2.0.3) warnings.
        +1 common tests 23m 5s Tests passed in hadoop-common.
            59m 56s  



        Subsystem Report/Notes
        Patch URL http://issues.apache.org/jira/secure/attachment/12665692/HADOOP-10364.2.patch
        Optional Tests javadoc javac unit findbugs checkstyle
        git revision trunk / a60f78e
        checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/artifact/patchprocess/diffcheckstylehadoop-common.txt
        whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/artifact/patchprocess/whitespace.txt
        hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/artifact/patchprocess/testrun_hadoop-common.txt
        Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/testReport/
        Java 1.7.0_55
        uname Linux asf906.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
        Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/console

        This message was automatically generated.

        Show
        Hadoop QA added a comment - -1 overall Vote Subsystem Runtime Comment 0 pre-patch 14m 27s Pre-patch trunk compilation is healthy. +1 @author 0m 0s The patch does not contain any @author tags. -1 tests included 0m 0s The patch doesn't appear to include any new or modified tests. Please justify why no new tests are needed for this patch. Also please list what manual steps were performed to verify this patch. +1 javac 7m 28s There were no new javac warning messages. +1 javadoc 9m 36s There were no new javadoc warning messages. +1 release audit 0m 22s The applied patch does not increase the total number of release audit warnings. -1 checkstyle 1m 7s The applied patch generated 2 new checkstyle issues (total was 176, now 176). -1 whitespace 0m 0s The patch has 1 line(s) that end in whitespace. Use git apply --whitespace=fix. +1 install 1m 36s mvn install still works. +1 eclipse:eclipse 0m 32s The patch built with eclipse:eclipse. +1 findbugs 1m 40s The patch does not introduce any new Findbugs (version 2.0.3) warnings. +1 common tests 23m 5s Tests passed in hadoop-common.     59m 56s   Subsystem Report/Notes Patch URL http://issues.apache.org/jira/secure/attachment/12665692/HADOOP-10364.2.patch Optional Tests javadoc javac unit findbugs checkstyle git revision trunk / a60f78e checkstyle https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/artifact/patchprocess/diffcheckstylehadoop-common.txt whitespace https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/artifact/patchprocess/whitespace.txt hadoop-common test log https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/artifact/patchprocess/testrun_hadoop-common.txt Test Results https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/testReport/ Java 1.7.0_55 uname Linux asf906.gq1.ygridcore.net 3.13.0-36-lowlatency #63-Ubuntu SMP PREEMPT Wed Sep 3 21:56:12 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux Console output https://builds.apache.org/job/PreCommit-HADOOP-Build/6577/console This message was automatically generated.

          People

          • Assignee:
            Unassigned
            Reporter:
            Ted Yu
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:

              Development