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

Use IOUtils.closeStream while closing streams in FileUtil.java

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • None
    • None
    • None
    • None

    Description

      Please check following code for same..

      try {
              in = srcFS.open(src);
              out = dstFS.create(dst, overwrite);
              IOUtils.copyBytes(in, out, conf, true);
            } catch (IOException e) {
              IOUtils.closeStream(out);
              IOUtils.closeStream(in);
              throw e;
            }
          }
      

      can we use IOUtils.closeStream while closing the streams

        IOUtils.copyBytes(in, out, conf, false);
                  if (addString!=null)
                    out.write(addString.getBytes("UTF-8"));
                      
                } finally {
                  in.close();
                } 
              }
            }
          } finally {
            out.close();
          }
      

      Attachments

        1. HADOOP-11392-1.patch
          0.7 kB
          Brahma Reddy Battula
        2. HADOOP-11392.patch
          0.8 kB
          Brahma Reddy Battula

        Issue Links

          Activity

            People

              brahmareddy Brahma Reddy Battula
              brahmareddy Brahma Reddy Battula
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: