Hadoop Common
  1. Hadoop Common
  2. HADOOP-7437

IOUtils.copybytes will suppress the stream closure exceptions.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: hudson, 0.23.0
    • Fix Version/s: 0.23.0
    • Component/s: io
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      
      public static void copyBytes(InputStream in, OutputStream out, long count,
            boolean close) throws IOException {
          byte buf[] = new byte[4096];
          long bytesRemaining = count;
          int bytesRead;
      
          try {
            .............
            .............
          } finally {
            if (close) {
              closeStream(out);
              closeStream(in);
            }
          }
        }
      
      

      Here if any exception in closing the stream, it will get suppressed here.

      So, better to follow the stream closure pattern as HADOOP-7194.

      1. HADOOP-7437.patch
        3 kB
        Uma Maheswara Rao G

        Issue Links

          Activity

          Hide
          Uma Maheswara Rao G added a comment -

          Provided the patch.

          Show
          Uma Maheswara Rao G added a comment - Provided the patch.
          Hide
          Hadoop QA added a comment -

          +1 overall. Here are the results of testing the latest attachment
          http://issues.apache.org/jira/secure/attachment/12484868/HADOOP-7437.patch
          against trunk revision 1141638.

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

          +1 tests included. The patch appears to include 3 new or modified tests.

          +1 javadoc. The javadoc tool did not generate any warning messages.

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

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

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

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

          +1 system test framework. The patch passed system test framework compile.

          Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/689//testReport/
          Findbugs warnings: https://builds.apache.org/job/PreCommit-HADOOP-Build/689//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html
          Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/689//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/12484868/HADOOP-7437.patch against trunk revision 1141638. +1 @author. The patch does not contain any @author tags. +1 tests included. The patch appears to include 3 new or modified tests. +1 javadoc. The javadoc tool did not generate any warning messages. +1 javac. The applied patch does not increase the total number of javac compiler warnings. +1 findbugs. The patch does not introduce any new Findbugs (version 1.3.9) warnings. +1 release audit. The applied patch does not increase the total number of release audit warnings. +1 core tests. The patch passed core unit tests. +1 system test framework. The patch passed system test framework compile. Test results: https://builds.apache.org/job/PreCommit-HADOOP-Build/689//testReport/ Findbugs warnings: https://builds.apache.org/job/PreCommit-HADOOP-Build/689//artifact/trunk/build/test/findbugs/newPatchFindbugsWarnings.html Console output: https://builds.apache.org/job/PreCommit-HADOOP-Build/689//console This message is automatically generated.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          +1 patch looks good.

          Show
          Tsz Wo Nicholas Sze added a comment - +1 patch looks good.
          Hide
          Tsz Wo Nicholas Sze added a comment -

          I have committed this. Thanks Uma!

          Show
          Tsz Wo Nicholas Sze added a comment - I have committed this. Thanks Uma!
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Common-trunk-Commit #670 (See https://builds.apache.org/job/Hadoop-Common-trunk-Commit/670/)
          HADOOP-7437. IOUtils.copybytes will suppress the stream closure exceptions. Contributed by Uma Maheswara Rao G

          szetszwo : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142535
          Files :

          • /hadoop/common/trunk/common/CHANGES.txt
          • /hadoop/common/trunk/common/src/java/org/apache/hadoop/io/IOUtils.java
          • /hadoop/common/trunk/common/src/test/core/org/apache/hadoop/io/TestIOUtils.java
          Show
          Hudson added a comment - Integrated in Hadoop-Common-trunk-Commit #670 (See https://builds.apache.org/job/Hadoop-Common-trunk-Commit/670/ ) HADOOP-7437 . IOUtils.copybytes will suppress the stream closure exceptions. Contributed by Uma Maheswara Rao G szetszwo : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142535 Files : /hadoop/common/trunk/common/CHANGES.txt /hadoop/common/trunk/common/src/java/org/apache/hadoop/io/IOUtils.java /hadoop/common/trunk/common/src/test/core/org/apache/hadoop/io/TestIOUtils.java
          Hide
          Hudson added a comment -

          Integrated in Hadoop-Common-trunk #737 (See https://builds.apache.org/job/Hadoop-Common-trunk/737/)
          HADOOP-7437. IOUtils.copybytes will suppress the stream closure exceptions. Contributed by Uma Maheswara Rao G

          szetszwo : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142535
          Files :

          • /hadoop/common/trunk/common/CHANGES.txt
          • /hadoop/common/trunk/common/src/java/org/apache/hadoop/io/IOUtils.java
          • /hadoop/common/trunk/common/src/test/core/org/apache/hadoop/io/TestIOUtils.java
          Show
          Hudson added a comment - Integrated in Hadoop-Common-trunk #737 (See https://builds.apache.org/job/Hadoop-Common-trunk/737/ ) HADOOP-7437 . IOUtils.copybytes will suppress the stream closure exceptions. Contributed by Uma Maheswara Rao G szetszwo : http://svn.apache.org/viewcvs.cgi/?root=Apache-SVN&view=rev&rev=1142535 Files : /hadoop/common/trunk/common/CHANGES.txt /hadoop/common/trunk/common/src/java/org/apache/hadoop/io/IOUtils.java /hadoop/common/trunk/common/src/test/core/org/apache/hadoop/io/TestIOUtils.java
          Hide
          Eli Collins added a comment -

          Should't this fix all the copyBytes methods, not just one of them?

          Show
          Eli Collins added a comment - Should't this fix all the copyBytes methods, not just one of them?
          Hide
          Uma Maheswara Rao G added a comment -

          Hi Eli, thanks for comments.
          when i checked the code, i found that we already handled as part of HADOOP-7194 for other copybytes api.

          Show
          Uma Maheswara Rao G added a comment - Hi Eli, thanks for comments. when i checked the code, i found that we already handled as part of HADOOP-7194 for other copybytes api.

            People

            • Assignee:
              Uma Maheswara Rao G
              Reporter:
              Uma Maheswara Rao G
            • Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development